Enhancements to Debugging Exceptions with IntelliTrace in Visual Studio 2013
The Microsoft Monitoring Agent allows you to collect reliability and performance data for web applications and to review the data using IntelliTrace. With Visual Studio 2013 Update 2, we have added the ability to more easily navigate the diagnostics data related to an exception by using a CodeLens-enhanced Code Map view in combination with the existing IntelliTrace experience.
Today when I start debugging by double clicking an exception from the summary page, on the call stack window I have to double click each stack frame to examine the parameters of the previous stack frame. This makes it tedious searching for parameters while keeping in mind what the exception was that was thrown. To address that, we have combined the information you get from 3 different windows into a one that is easier to use.
Let’s examine that experience in this blog post.
For this example, assume that I have collected data using the Microsoft Monitoring Agent for my MVC application that threw an exception. I open up the resulting IntelliTrace file in Visual Studio, open the associated solution from the Open Solutions gold bar and on the summary page I can see the exception that was thrown from the MVC application. Opening the solution is useful so that I can see the CodeLens indicators like history of code changes on the methods that led to the exception. If the solution is not opened IntelliTrace would still show the source files.
I double click on the row with the exception message (or click on the “Debug Newest Exception in Group”) and IntelliTrace starts debugging and now displays a Code Map view of the call stack that led to the exception.
The Code Map window now shows the method that threw the exception. It also contains an annotated comment that describes the exception message. This makes it easier to visualize all the context that led to the exception in one convenient window instead of having to manually navigate between the IntelliTrace events window, call stack window and locals window to make that connection.
If the methods in the Code Map window contains parameters then a ‘Parameters’ link is displayed above the method name. When the link is clicked a CodeLens popup window is shown that contains the list of parameters of that method. The benefit of seeing the parameters in the popup window is that I don’t have to switch to the context of that method to see the parameters in the locals window. Hence it makes it easier to view the parameters of different methods from a single Code Map window.
The parameter ‘@id’ with value ‘121’ corresponds to the code where the InvalidOperationException was thrown.
The docked Code Lens window makes it easier to compare parameters with the popup window from other methods.
Show External Code
To see all the external methods in the Code Map window I can enable the ‘Show External Code’ option from the right click menu in the call stack window. I can click on the ‘Parameters’ link on the methods to see more interesting parameters.
Navigation to source
I can double click on the method that threw the exception in the Code Map window to navigate to the source – here is a screenshot of what that may look like:
Code Map Window
Please note if the Code Map window ‘CallStack1.dgml’ is closed then it can be restored back by clicking the ‘Code Map’ button from the Debugger toolbar.
I can also select all the methods in the Code Map using the keyboard shortcut ‘Ctrl+A’ and then press the ‘Del’ key to clear the graph. This could be useful if I want to start debugging from another exception from the summary page of the same IntelliTrace file or another exception from a different IntelliTrace file and don’t want the stale methods from the previous exception.
We hope you find the ability to visualize the call stack of the exception and parameters on the methods help understand the context that led to the exception. For feedback on this, or any IntelliTrace feature, please ask us at our diagnostics MSDN forum.