Last week the Microsoft Central District asked me to come down and do a road show through Texas and Arkansas. What a road show it was; seven flights, six different hotels, and 20+ hours driving between places in six days. But it was all worth it because I got to talk about my favorite feature in Visual Studio: IntelliTrace.

What I find sad about today’s debugging tools is that they are essentially warmed over 1970’s technology. We are still setting a breakpoint on a source line in the debugger like just like your great grandparents were back in their day. The art has moved very little if at all. In an ideal world, we would have tools that record the video of your application’s internals but wouldn’t destroy performance. That’s exactly what IntelliTrace was designed to accomplish.

The ability to have that IntelliTrace video of the events that happened while debugging your application day-to-day is the key to debugging faster. As Steve McConnell’s outstanding book Code Complete 2nd ed. mentions your average team spends 50% of their time debugging or performance tuning. No matter how agile, scrummy, or kanbanny you get, shrinking that debugging time is the key to shipping on time. I use IntelliTrace religiously and I’m easily debugging 10%-20% faster. That’s a massive speed up in overall development time.

One complaint I hear about IntelliTrace is that it’s only part of VS Ultimate and it costs too much. Actually, the cost of Ultimate is cheap because the cost savings of a single bug will more than pay for Ultimate. You cost your company a lot of money in salary and benefits and that’s the real money you need to be saving, not being cheap on the nickel and dime stuff.

As you’re debugging, get in the habit of looking at the IntelliTrace window before you look at anything in the debugger. The flow of events tells you what your code has been doing in the past so you can see how you got to the present. During the road show I found far too many people were not using IntelliTrace, nor did they have it set up correctly. Feel free to imagine me in my finest drill sergeant voice screaming at you to get you started using IntelliTrace. But first let me show you how to set up IntelliTrace because the defaults are wrong.

Why are the carefully chosen defaults wrong? In my opinion, the team focused on the wrong thing. They were worried about runtime performance instead of the real performance of shortening debugging time, which is far more important. The IntelliTrace team was worried about people turning off IntelliTrace altogether so they went with limited recording. I could care less about how slow something runs when debugging because I want to find problems and will trade runtime for debug time any day. I want to record everything the tool can possibly record to make finding bugs easier. Do the following three steps in the Options dialog and you’ll be on your way to IntelliTrace happiness.

Step 1: Turn on IntelliTrace Events and Call Information. Now you’ll be able to walk backwards in your code seeing how the flow of operation occurred.

clip_image002

Step 2: Turn on Store IntelliTrace recordings in this directory. By default, IntelliTrace deletes the recording when you stop debugging but there are many times you want to look at the recording after you finish. With this option checked, you’ll have the file location set so you can find the files. You can also use my WintellectVSCmdlets PowerShell module in Visual Studio to use Open-LastIntelliTraceRecording.

clip_image004

Step 3: Turn on all events. This is the setting where I feel the team messed up the most. The default is only part of the events so you miss extremely valuable data in your recording.

clip_image006

In the presentation, I listed numerous resources on IntelliTrace so thought I’d push them out here so you can learn more.

John’s Twitter Alias (@JohnWintellect)
https://twitter.com/#!/JohnWintellect

Wintellect’s Open Source Code (WintellectPowerShell and WintellectVSCmdlets)
http://code.wintellect.com

My blog entry of how IntelliTrace works under the hood (the code name was Historical Debugging)
https://www.wintellect.com/cs/blogs/jrobbins/archive/2009/06/16/how-does-vs2010-historical-debugging-work.aspx

IntelliTrace Standalone Collector
http://go.microsoft.com/fwlink/?LinkId=245688

Performance impact in production
http://blogs.msdn.com/b/visualstudioalm/archive/2012/05/18/optimizing-intellitrace-collection-on-production-server.aspx

Great examples for creating custom events
http://blog.qetza.net/en/2010/03/08/vs-2010-personnalisation-des-vnements-de-lintellitrace/

Using IntelliTrace on Windows Services
http://blogs.msdn.com/b/msaffer/archive/2011/02/23/using-intellitrace-with-services.aspx

Using PowerShell Remoting with IntelliTrace
http://blogs.msdn.com/b/visualstudioalm/archive/2012/07/09/using-the-intellitrace-standalone-collector-remotely.aspx

Now it’s your turn to start using IntelliTrace better and uncover the nastiest bugs in your code. We will be recording the IntelliTrace session I did and making it available in the near future. If you have VS Ultimate 2010 or 2012, start using IntelliTrace and use the extra time you save to add new features, pay off technical debt, or even go home on time for a change.