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.

Hello IntelliTrace Application

Double-click on the button and add the following line to the click event handler.

Debug.WriteLine("Hello IntelliTrace!")

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.

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:

  1. The application started under the debugger
  2. The user clicked on a button with the label "Hello IntelliTrace!"
  3. The application output some trace information using Debug.WriteLine()
  4. The application paused in the debugger

IntelliTrace window with annotations

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.

Source window

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.

Habib Heydarian.