Export (0) Print
Expand All

Record Code Execution with IntelliTrace for Debugging in Visual Studio

To record and trace the execution history of your code or app with IntelliTrace in Visual Studio Ultimate, just start debugging as usual. By default, IntelliTrace is turned on and automatically records specific events and data so you can more easily see what happened in your app. See Debug Your App by Recording Code Execution with IntelliTrace.

To confirm that IntelliTrace is turned on:

Enable or disable IntelliTrace in Visual Studio

Note Note

Clearing Enable IntelliTrace turns off all custom IntelliTrace settings. These settings apply to all projects and solutions. They persist between debugging sessions and Visual Studio sessions.

You can try debugging with just IntelliTrace events to see if this alone helps you find your bug. IntelliTrace events are debugger events, exceptions, .NET Framework events, and other system events. You can turn on or turn off specific events to control the events that IntelliTrace records, but do this before you start debugging.

Here's a visual overview about debugging with IntelliTrace events only:

IntelliTrace events only - repro the bug

IntelliTrace events only - event details and code

IntelliTrace events only - found bug

Back to top

Here's detailed steps for debugging with IntelliTrace events only:

  1. Start debugging as usual. Reproduce the bug.

    Tip Tip

    Keep the Locals and Autos windows open to see and record the values shown in those windows. To start debugging, press F5 or on the Debug menu, choose Start Debugging. If you don't see the IntelliTrace window when you start debugging, IntelliTrace might not be turned on or the window might be closed. To open the IntelliTrace window, go to Debug, IntelliTrace, IntelliTrace Events.

  2. Break your app's execution manually.

    Tip Tip

    On the Debug menu or in the IntelliTrace window, choose Break All.

    Now you see a chronological list of events in the IntelliTrace window, starting at the top with the first event and ending with the last event when the debugger broke execution.

    IntelliTrace window showing diagnostic events
  3. Find the event closest to where you reproduced the bug, in this case, before your app broke execution.

  4. Choose the event to expand its details.

    • If source code is available, Visual Studio moves the pointer to the corresponding code in the source window so you can examine it.

    • To see data that IntelliTrace recorded when the event happened, choose a Related views link to see the corresponding debugger window.

    • If the event is a file-access event, choose the pathname link to open the file. If the full pathname is not available, find the file by using the search box that appears.

  5. If you didn't find the bug, try examining other events leading up to the bug. You can also have IntelliTrace record call information so you can step through function calls.

Back to top

You can turn on or turn off recording for specific IntelliTrace events except for debugger events and exceptions, which IntelliTrace always records.

  1. If you're debugging, stop debugging. Otherwise, restart debugging after choosing events.

  2. Go to Tools, Options, IntelliTrace, IntelliTrace Events. Choose the events and event categories for IntelliTrace to record.

    Configure IntelliTrace event collection

Back to top

If you have to examine your app's function call sequence to find your bug, IntelliTrace can record function calls along with events. This lets you see the call stack history, step backward and forward through calls in your code, and see the data that IntelliTrace recorded, such as function names, their entry and exit points, and certain parameter values and return values. See Debug Your App by Recording Code Execution with IntelliTrace.

  1. If you're debugging, stop debugging. Otherwise, restart debugging after turning on call collection.

  2. Turn on call collection.

    Configure call collection for IntelliTrace

    Tip Tip

    This might slow down your app and increase the size of any IntelliTrace log files (.iTrace files) that you're saving to disk. To get the most call data but minimize the effects, record data from only those modules that interest you. To change the maximum size of your .iTrace files, go to Tools, Options, IntelliTrace, Advanced.

  3. Start debugging as usual. Reproduce the bug.

    Tip Tip

    Keep the Locals and Autos windows to see and record the values shown in those windows. To start debugging, press F5 or on the Debug menu, choose Start Debugging. If you don't see the IntelliTrace window when you start debugging, IntelliTrace might not be turned on or the window might be closed. To open the IntelliTrace window, go to Debug, IntelliTrace, IntelliTrace Events.

  4. Break your app's execution manually.

    Tip Tip

    On the Debug menu or in the IntelliTrace window, choose Break All.

  5. Find the event closest to where you reproduced the bug. See Debug with events only.

  6. Choose the event to expand its details. Next to Related views, choose Calls View.

    IntelliTrace window showing diagnostic events

    Now you see your app's call stack history, starting at the top with your app's root call and ending with the current call relative to the event you chose, not current as in real time.

    IntelliTrace Window Calls View

    Indented under the current call, another list shows the calls that the current call made to other functions. The indented list also shows you IntelliTrace events for the current call.

    Note Note

    Calls appear dimmed because IntelliTrace didn't record data from the corresponding modules. To see this data, have IntelliTrace collect data from those modules.

  7. Find the call that follows the event you chose. Double-click this call so you can step into it.

    In the Calls View window, the call that you stepped into is now the new current call at the bottom of the call stack. The indented list now shows calls and events for this new current call. The source window and debugger windows are also updated for this new current call.

    Tip Tip

    If you just want to see the call site, single-click the call in the Calls View window instead of double-clicking it. This moves the pointer to the call site but does not step into the call so that you're still in the current call.

  8. To step through calls and events, use the navigation gutter that appears alongside the source window when call information is available. If you don't see the navigation gutter, go to Tools, Options, IntelliTrace, Advanced. Choose Display the navigation gutter while in debug mode.

    Set Debugger Context Here

    Set the debugging context to the call timeframe where it appears.

    This icon appears only on each frame of the current call stack.

    Return to Call Site

    Move the pointer and debugging context back in time to where the current function was called.

    If you are in traditional debugging mode, this command causes you to start debugging with IntelliTrace.

    Go to Previous Call or IntelliTrace Event

    Move the pointer and debugging context back in time to the previous call or event.

    If you are in traditional debugging node, this command causes you to start debugging with IntelliTrace.

    Step In

    Move the pointer and debugging context forward in time into the currently selected function.

    This command is available only when you are debugging with IntelliTrace.

    Go to Next Call or IntelliTrace Event

    Move the pointer and debugging context forward in time to the next call or event for which IntelliTrace data exists.

    This command is available only when you are debugging with IntelliTrace.

    Go to Live Mode

    Return to traditional debugging where you started debugging with IntelliTrace.

  9. To find a specific instance of a call, search the IntelliTrace history for recorded instances of that call:

    1. From a line of code where the call is made:

      Find call instance during IntelliTrace debugging

      Note Note

      If the line is a method exit, you won't get accurate results.

      - or -

      From inside the body of the function that is called:

      1. Make sure that the project file containing the function is open in Visual Studio.

      2. Open the shortcut menu inside the body of the function. Choose Search For This Method In IntelliTrace.

    2. Browse the results to find the instance that interests you. Choose the instance to synchronize the Calls View window and to examine the recorded data for that instance.

Back to top

You can have IntelliTrace record call information only for those modules that interest you. This can also help improve your app's performance.

To add multiple modules, use the wildcard character * at the start or the end of the string. For module names, use file names, not assembly names. File paths are not accepted.

Configure module collection for IntelliTrace
Note Note

Excluding modules might still result in collecting data from modules that might not interest you, such as third-party or open-source modules.

Back to top

To continue your session at a later time, save the session as an IntelliTrace log file (.iTrace file).

Save your session manually

Save IntelliTrace manually in Visual Studio

Save your session automatically

Save IntelliTrace session automatically

Tip Tip

To save disk space, turn off saving .iTrace files when you don’t need them anymore. Any existing .iTrace files will remain.

Visual Studio limits the default .iTrace file size to 250 MB because IntelliTrace can collect lots of data. When the file reaches its limit, Visual Studio makes space for newer entries by deleting the earliest entries. To save more data than the default limit, change the file's maximum recording size.

Visual Studio creates two .iTrace files for each IntelliTrace session when they are saved automatically and the Visual Studio hosting process (vshost.exe) is turned on. Visual Studio creates one .iTrace file for the app and one .iTrace file for the hosting process. This process improves debugging performance, enables certain debugging capabilities, and is turned on by default.

What data does the .iTrace file contain?

An .iTrace file contains details about exceptions, threads, Web requests, test data, modules, and other system information. When you open the file in Visual Studio Ultimate, select an item, and start debugging, you can go to any event in the file to examine related code and recorded data about your app at that time. See Debug Your App with IntelliTrace Log (.iTrace) Files.

To debug errors or crashes that happen during testing in Microsoft Test Manager but are hard to reproduce in your development environment, try configuring Test Manager to collect IntelliTrace data. You can save this data to an .iTrace file and attach to a Team Foundation Server work item for further investigation. See Analyze failed tests and track bugs.

To debug errors or crashes that happen where you don’t want to change the system configuration, such as production environments, try using the standalone collector to save IntelliTrace data to an .iTrace file. See Monitor apps in deployment with Microsoft Monitoring Agent.

Back to top

Show:
© 2014 Microsoft