IntelliTrace As a Learning Tool for MVC2 in a VS2010 Project

Posted by Sam Abraham on Geeks with Blogs See other posts from Geeks with Blogs or by Sam Abraham
Published on Thu, 15 Apr 2010 18:28:05 GMT Indexed on 2010/04/16 0:43 UTC
Read the original article Hit count: 753

Filed under:

IntelliTrace is a new feature in Visual Studio 2010 Ultimate Edition. I see this valuable tool as a “Program Execution Recorder” that captures information about events and calls taking place as soon as we hit the VS2010 play (Start Debugging) button or the F5 key. Many online resources already discuss IntelliTrace and the benefit it brings to both developers and testers alike so I see no value of just repeating this information. 

In this brief blog entry, I would like to share with you how I will be using IntelliTrace in my upcoming talk at the Ft Lauderdale ArcSig .Net User Group Meeting on April 20th 2010 (check http://www.fladotnet.com for more information), as a learning tool to demonstrate the internals of the lifecycle of an MVC2 application.  I will also be providing some helpful links that cover IntelliTrace in more detail at the end of my article for reference.

IntelliTrace is setup by default to only capture execution events. Microsoft did such a great job on optimizing its recording process that I haven’t even felt the slightest performance hit with IntelliTrace running as I was debugging my solutions and projects.  For my purposes here however, I needed to capture more information beyond execution events, so I turned on the option for capturing calls in addition to events as shown in Figures 1 and 2. Changing capture options will require us to stop our debugging session and start over for the new settings to take place.


Figure 1 – Access IntelliTrace options via the Tools->Options menu items


Figure 2 – Change IntelliTrace Options to capture call information as well as events

Notice the warning with regards to potentially degrading performance when selecting to capture call information in addition to the default events-only setting. I have found this warning to be sure true. My subsequent tests showed slowness in page load times compared to rendering those same exact pages with the “event-only” option selected.

Execution recording is auto-started along with the new debugging session of our project. At this point, we can simply interact with the application and continue executing normally until we decide to “playback” the code we have executed so far.  For code replay, first step is to “break” the current execution as show in Figure 3.


 
Figure 3 – Break to replay recording

A few tries later, I found a good process to quickly find and demonstrate the MVC2 page lifecycle.
First-off, we start with the event view as shown in Figure 4 until we find an interesting event that needs further studying. 


Figure 4 – Going through IntelliTrace’s events and picking as specific entry of interest

We now can, for instance, study how the highlighted HTTP GET request is being handled, by clicking on the “Calls View” for that particular event. Notice that IntelliTrace shows us all calls that took place in servicing that GET request. Double clicking on any call takes us to a more granular view of the call stack within that clicked call, up until getting to a specific line of code where we can do a line-by-line replay of the execution from that point onwards using F10 or F11 just like our typical good old VS2008 debugging helped us accomplish.


Figure 5 – switching to call view on an event of interest


Figure 6 – Double clicking on call shows a more granular view of the call stack.

In conclusion, the introduction of IntelliTrace as a new addition to the VS developers’ tool arsenal enhances development and debugging experience and effectively tackles the “no-repro” problem. It will also hopefully enhance my audience’s experience listening to me speaking about  an MVC2 page lifecycle which I can now easily visually demonstrate, thereby improving the probability of keeping everybody awake a little longer.

IntelliTrace References:
http://msdn.microsoft.com/en-us/magazine/ee336126.aspx
http://msdn.microsoft.com/en-us/library/dd264944(VS.100).aspx

 

© Geeks with Blogs or respective owner