Visual Studio 2010's New 'IntelliTrace' Feature
I'm at DevConnections this week in Las Vegas speaking at the Visual Studio 2010 launch event and had a chance to catch up with one of my favorite people -- Ward Bell. Ward is the Vice President of IdeaBlade and was one of the presenters during Scott Guthrie's keynote address. He covered an interesting new feature called "IntelliTrace" that provides a way to capture information during a debug session. Ward and I sat down for a quick chat to talk more about what IntelliTrace offers .NET developers.
Tell me about IntelliTrace.
IntelliTrace is a terrific new historical debugging tool built into Visual Studio 2010. You can think of it as a type of time machine where you can record your application's events as its run and then move backwards and forwards in time through the debugger.
When would you use it?
Have you ever had to deal with one of those chutes and ladders code bases where one thing leads to the next thing which leads to the next thing and you don't know what's really happening? This can be especially hard to deal with when you have an application with a lot of loosely coupled components all being created with dependency injection. You can't do static analysis because nothing refers to anything else since its all dynamic. What do you do today? You place a bunch of break points, you step through, and you go past some point and go "uh", I want to go backwards -- where did I come from?
So then you start over from the beginning and try to remember to stop at the appropriate spot. IntelliTrace allows you to replay exactly what happened as the application ran. I can step forward and backward, it shows me a full stack trace at all times, and I can even see parameters and return values that were passed around.
How do I set it up in Visual Studio?
Go to Tools --> Options --> IntelliTrace. It's enabled by default but will only capture events since they're not expensive to capture. However, the real value begins when you start tracking all of the call information. Every time you debug, IntelliTrace will pop-up and you can use the historical debugger while you're debugging live. Meaning, suppose I'm in there and have a break but want to back up and re-approach the break point, I can do that with IntelliTrace.
I understand you can replay captured sessions?
Yes, somebody else who has captured a debugging session with IntelliTrace can send you the log and the .dlls and pdbs if you don't have them and you can replay their session. The session may have gone to the database (which you don't have), it could be configured in a way you can't reproduce, it could be on a network you can't reach, but you don't care because with a log and the .dlls and pdbs you can replay it.
Having the source code is even better of course because then you can see it as if you were debugging it on your own machine. It's great for those mystery failures where it works on your machine but not someone else's. It's also great in multi-threaded situations where the bug disappears when you step through the application but shows up at regular speed.
Any caveats and how do you work around them?
The most obvious one is that you can't do a debug record on 64-bit machines. You can play back log sessions fine, but you can't F5 to start debugging and recording. But, there's a trick!
If you can change your configuration to run as 32-bit, you can F5 and record. Check out these screenshots that shows what needs to be changed: