IntelliTrace and unfamiliar code

One of the many great things about the new IntelliTrace feature in Visual Studio Ultimate 2010 is the ability to walk up to a code base you are not familiar with and determine where to set your first break point.

How many times have you walked up to some code you’ve never modified with the thought, “boy, I’d love to just set a break point in that button clicked event handler…”? With IntelliTrace, that scenario is very simple.

Let me show you, by following along the following steps:

  1. Please download this sample app. All screen shots are coming from that application.

  2. Next, ensure you are running IntelliTrace with the default settings enabled. Best way to do that is to go to Tools->Options… and make sure your screen options look similar to mine:

    image

    image

    SNAGHTML2be14964

    SNAGHTML2be22532

  3. Open up the CardGame solution and hit F5. You’ll see the following window ( minus the comment bubble ).

    SNAGHTML2be5eded

    What we want to do is find out where in the code the “button clicked” event for the “New Game” button is being handled.

  4. Click the “New Game” button
    You should now see something like this:
    SNAGHTML2beac152

  5. Ensure the IntelliTrace tool window is displayed in Visual Studio by selecting Debug->IntelliTrace->IntelliTrace Events:
    image 

    After selecting that menu item, you should see the following tool window in Visual Studio:

    image
    Click the “Break All” button.

  6. Select the “Gesture” event in the IntelliTrace tool window:
    image

  7. Notice how source code is raised in the document well, with the button handler highlighted. NICE!

    image

Now imagine you wanted to do a similar thing, except you wanted to see Gesture events associated with the clicking of a check box. No problem, but you will need to enable that event in the Options dialog, as it is not checked by default:

SNAGHTML2bfad57e

Be sure to explore the “IntelliTrace Events” in the Options dialog, as you will find all kinds of other options that you can use to get quickly into unfamiliar code, such as when the registry or file is being accessed, perhaps when an environment variable is being set, and so on.

As you explore further, keep in mind that you are able to filter the events in the IntelliTrace tool window so that you only see Gesture events ( for example ). You can do that quickly by typing in “Gesture” in the search toolbox of the IntelliTrace window:

SNAGHTML2c01b937

Or by pulling the “All Categories” combo box down, deselecting all ( by unchecking the “All Categories” option ), and selecting “Gesture”:

SNAGHTML2c03eb9d

 

Summary

This ability to quickly get into a code base that you are unfamiliar with by directing you to the location where you can set your first break point based on gestures made with your application can really save a lot of time. This is of course, just the beginning of all the things this new feature set allows you to do.

More later. Stay tuned…

Cameron