Advanced .NET Debugging
Author: Mario Hewardt
Rating: 5 out of 5 stars
.NET developers are lucky. The abstraction of runtime code within a managed environment means that many of the problems that plague non-managed code applications are reduced or eradicated. However, as experienced .NET developers know, isolating problems, optimizing processes and the art of effective debugging remain a critical skill for .NET application construction.
Author Mario Hewardt, a Senior Development Lead with Microsoft, made a name for himself with his earlier book, Advanced Windows Debugging, also published by Addison-Wesley. And while the topic is the same, the environment is very different. Working with and debugging managed code requires a completely different way of going about the debugging process. There is a reason why this book's title begins with the word "Advanced". It goes far beyond the simple use of breakpoints, call stacks and watch windows. Readers are guided into a much deeper debugging realm using tools ranging from CDB, the CLR Profiler and NTSD to the PowerDBG and WinDBG analyzers. All-important aspects from heap and garbage collection to .NET exceptions and inter-op layer probing are also covered with exceptional detail.
The book is divided into three parts: Overview, Applied Debugging and Advanced Topics. Beginning with the free download of the Debugging Tools for Windows package (http://www.microsoft.com/whdc/devtools/debugging), the author steps through the various tools in that package. Each is presented with a description and example of the tool in action. The CLR is deconstructed to better understand its inner workings so when problems arise, it is no longer a black box to be avoided but rather a treasure trove to be explored. This understanding is put to practical use in the book's lengthiest chapter on basic debugging tasks. There was a lot of information in that chapter, and I had to read it twice to reinforce all the activities that happen during a .NET debugging session.
The second part of the book spans over 200 pages and details the Assembly Loader, managed heap and garbage collection, synchronization and interoperability considerations. An adequate amount of sample code demonstrating the nuances of each of these topics imbue a richer understanding of the inner-workings of these .NET aspects. Combined with the author's communication skills and mastery of the subject matter, intermediate developers who take time to read and execute the practice code will be considerably more competent debugging their .NET projects as a result.
The book's final part covers advanced topics such as the challenging aspects of postmortem debugging, the use of powerful debugging tools like PowerShell's PowerDbg and VS2008's source-level debugging capabilities, and concludes with a chapter on what's in store with the 4.0 release of the CLR.
All the code samples in the book are exclusively presented in C#, and the graphs, illustrations and screenshots are very helpful in demonstrating the author's instructions. Intermediate to experienced .NET developers will find Advanced .NET Debugging a valuable educational investment toward a much deeper understanding of the CLR in order to more quickly assess, debug and optimize their application projects. Highly recommended.