The best way to get an idea of the features that Debug Analyzer.NET includes is to take a look at the main screen of the Debug Analyzer UI shown in Figure 1.
Figure 1 Main screen of Debug Analyzer.NET
Debug Analyzer.NET works on the basis of crash dump files that are (in a nutshell) static snapshots of a process that is exhibiting some type of problem. In order to tell Debug Analyzer.NET which crash dump file you want to analyze, simply click the File menu followed by the Open Dump menu item. Navigate to the folder containing the crash dump file, select the crash dump file, and click Open. At this point, you are ready to start using the many features that Debug Analyzer.NET has to offer.
At a high level, Debug Analyzer.NET works on the basis of templates that contain debug analysis logic for a particular problem type and/or technology. In Figure 1, we can see that there are templates for ASP.NET, WCF, ASP.NET, etc. Each of these templates contains one or more “plugs,” which is the fundamental unit of automation in Debug Analyzer.NET (we will cover how to write your own plugs later in the article).
Clicking on the Tools menu followed by the Analysis Templates menu item, you have the option of modifying existing templates as well as creating your own where you can select the plugs of interest. Once you have chosen a template, you can simply click the Run Analysis menu item, and the analysis defined in the selected template will run against the crash dump file that has been chosen. Figure 2 shows an example of a report generated when running a sample analysis.
Figure 2 Analysis report
In Figure 2, we have a breakdown of the managed heap by type, and the biggest type by size currently present on the managed heap is of type string. Furthermore, we get a list of top 10 types on the managed heap as well as specific GC heap information such as the generational segment starts. As you can see, the report in Figure 2 allows you to quickly hone in on certain misbehaving aspects such as figuring out why a great majority of types on the managed heap are strings.
Now that we are familiar with the main screen of the UI and the Analysis feature, let’s take a look at some additional features that Debug Analyzer.NET offers.
Quite often you may want to run some debug automation code that is not part of a plug or perhaps just a subset of code from a particular plug. In order to do that efficiently, Debug Analyzer.NET offers the Instant Analyzer feature. The Instant Analyzer feature can be accessed from the main UI by clicking on the Instant Analyzer menu item, which subsequently opens a new window as shown in Figure 3.
Figure 3 Instant analyzer window
The default code in the analyzer window is just a simple example that illustrates some of the available APIs to write results back to the report pane. If you click the Compile & Execute menu item, the code will be compiled and executed and the results reported in the bottom part of the window, as seen in Figure 4.
Figure 4 Result of instant analysis
The Instant Analysis feature is a real timesaver when developing plugs or if you want to do something simple and pinpointed that would otherwise not make sense in a standalone plug.
Even in the midst of all the fancy automation features that Debug Analyzer.NET provides, sometimes it may be necessary to go back and do some manual debugging based on the analysis that is performed. Rather than having to load up the same crash dump file in one of the debuggers in Debugging Tools for Windows, Debug Analyzer.NET offers an Interactive feature that can be accessed by clicking on the Interactive menu item. Once the Interactive window opens, you can type any debugger command just as you would within the actual debuggers. Figure 5 shows an example of the interactive window.
Figure 5 Interactive debugging feature
In Figure 5, you can see a simple example of using the native call stack commands to switch to thread 0 followed by dumping out the call stack.
When doing low level debugging, one of the biggest problems is the amount of information that has to be digested. Much of the time, the information is very terse and the digestion process becomes error-prone. Debug Analyzer.NET has a feature that tackles this problem called Visualization. With Visualization, Debug Analyzer.NET processes the raw data produced by the debugger into a nice visual form. Figure 6 shows an example of a managed heap visualizer.
Figure 6 CLR heap statistics
As you can see from Figure 6, the Visualizer breaks down the managed heap by type, allocation count, and size, making it easy to identify the biggest hitters on the managed heap.
Another great upcoming feature of the Visualizer is that it will be extensible, allowing others to create their own visualizers specific to their particular needs.