One of the most talked about features in Visual Studio 2010 Beta 2 is IntelliTrace. In a nutshell, IntelliTrace allows a developer to record the application execution and play it back. Using IntelliTrace, a developer can do some cool things like step back in the debugger.
In this blog post, I'll do a "Hello World!" version of IntelliTrace to help you get started with this feature. We'll start with a vanilla Windows Form project and use it to explore various capabilities of IntelliTrace.
To start with, create a brand new Windows Forms project using either VB or C#. Then, drag and drop a button on the form, as shown below.
Double-click on the button and add the following line to the click event handler.
Press F5 to run the application and then click on the "Hello IntelliTrace!" button. On the right-hand of the screen, you should see a new window called the IntelliTrace window, as shown below. Click on the "Break All" link in the IntelliTrace window.
After clicking the "Break All" button, the IntelliTrace window displays a number of very useful "events", as shown below. IntelliTrace records what happened in your application in chronological order. So, reading down the IntelliTrace window, you can see that the following things happened:
- The application started under the debugger
- The user clicked on a button with the label "Hello IntelliTrace!"
- The application output some trace information using Debug.WriteLine()
- The application paused in the debugger
What IntelliTrace is doing is keeping a diary or journal of the application as it was executing so that you can read through what happened. But what really makes the experience that much more compelling is that you can click on an event in the IntelliTrace window and navigate to the source code that caused that event, shown here.
In the next blog, I'll describe how you can customize IntelliTrace to collect additional events such as opening a file or reading from Windows registry keys.