Debugging with IntelliTrace in Visual Studio 2010

What mean debugging with IntelliTrace? Visual Studio 2010 Ultimate know the answer, because topic applies to Visual Studio 2010 Ultimate only. IntelliTrace extends and enhances the Visual Studio live debugging experience that you are used to. You still have access to all the Visual Studio debugger features that you are familiar with. IntelliTrace operates invisibly in the background, recording debug information.

When you want to look back at a past state of your application, you can enter IntelliTrace mode. In this mode, you can navigate to various points in time where events of interest have been recorded. You can also load and debug an IntelliTrace file, which has a .iTrace extension, Created by IntelliTrace or Test Manager, IntelliTrace files allow you to perform post-crash debugging with all the power of IntelliTrace.

When IntelliTrace is enabled, information is collected automatically during every debugging session. This IntelliTrace information enables you to switch from live debugging to debugging with IntelliTrace when you need to. The type of information collected is determined by options that you set at the Visual Studio level. These collection options apply to all projects and solutions. They persist between debug sessions and Visual Studio sessions.

Now how to debug the code? Visual Studio IDE gives us a lot of tools to debug our application. Sometimes debugging activity takes a very long time to identify the root cause. But VS IDE provides a lot of handy tools which help to debug code in a better way. Debugger features include error listing, adding breakpoints, visualize the program flow, control the flow of execution, data tips, watch variables and many more. Many of them are very common for many developers and many are not. In this article, I have discussed all the important features of VS IDE for debugging like Breakpoint, labeling and saving breakpoints, putting conditions and filter on breakpoints, DataTips, Watch windows, Multithreaded debugging, Thread window, overview of parallel debugging and overview of IntelliTrace Debugging.

IntelliTrace supports post-crash debugging of SharePoint applications and 64-bit applications through trace debugging log files created by Test Manager. It does not support debugging SharePoint applications or 64-bit applications launched from Visual Studio.

IntelliTrace supports debugging Visual Basic and C# applications that use .NET version 2.0, 3.0, 3.5, or 4. You can debug most applications, including applications that were created by using ASP.NET, Windows Forms, WPF, Windows Workflow, and WCF. IntelliTrace does not support debugging C++, script, or other languages. Debugging of F# applications is supported on an experimental basis.

With IntelliTrace, you can debug applications launched from Visual Studio and IntelliTrace files that were created by IntelliTrace or Test Manager. You cannot use IntelliTrace with applications launched outside Visual Studio and debugged using the Attach to command. IntelliTrace does not support remote debugging of applications that are running on other computers. IntelliTrace does not support debugging of Silverlight, Xbox, or Windows Mobile applications.

IntelliTrace events are events that occur while your application runs, which can be collected by IntelliTrace. Types of events that can be collected by IntelliTrace are as follows:

Debugger events. These are events that occur within the Visual Studio Debugger while you debug your application. The startup of your application is one debugger event. Other debugger events are stopping events, which are events that cause your application to enter a break state. Hitting a breakpoint, hitting a tracepoint, or executing a Step command are examples of stopping events.

For performance reasons, IntelliTrace does not collect all possible values for every debugger event. Instead, IntelliTrace collects values that are visible to the user. If the Autos window is open, for example, IntelliTrace collects values that are visible in the Autos window. If the Autos window is closed, those values are not collected.

If you point to a variable in a source window, the value that appears in the DataTip is collected. Values in a pinned DataTip are not collected, however. Exception events. These occur for handled exceptions, at the points where the exception is thrown and caught, and for unhandled exceptions. IntelliTrace collects the type of exception and the exception message.

Framework Events. These occur within the .NET library. You can view a complete list of .NET events that can be collected on the IntelliTrace Events page of the Options dialog box. The data collected by IntelliTrace varies by event. For a File Access event, IntelliTrace collects the name of the file; for a Check Checkbox, it collects the checkbox state and text; and so on.

Intellitrace in Visual Studio 2010 and Team Foundation Server 2010[youtube:WNvUHGnVsDs]

Debugging with IntelliTrace extends and enhances the typical Visual Studio debugging experience, without disruption to your usual workflow. If you use the default settings, IntelliTrace has minimal effect on application performance. You can choose to collect additional information beyond the default events.

To debug an application with IntelliTrace

Start Visual Studio debugging as usual. On the Debug menu, click Start Debugging. Use Visual Studio debugger windows, set breakpoints, and perform other debugging steps as usual. Enter break mode automatically when your application hits a breakpoint or when you click Break All in the Debug menu or the IntelliTrace window.

Use the IntelliTrace window when you need more information about past events. In the IntelliTrace events list, click an event that you want to view, as shown in the following illustration. To filter the events list by thread or category, use the two drop-down lists at the top of the window. To search for events that contain a specific string, type the string in the Search box, then click the magnifying glass icon. Click a Related views link to see related information in a debugger window. If the IntelliTrace event is a file-access event, you can click the pathname link to open the file. If the full pathname is not available, a search box appears. Use the search box to find the file.

Debugging with IntelliTrace in Visual Studio 2010

To see a list of IntelliTrace events that have been collected, click the IntelliTrace Events tab of the IntelliTrace window. Debugger events are always collected when IntelliTrace is enabled. You cannot turn off their collection.

Most common .Framework events are collected by default. You can use the following procedure to select other .NET events. Additionally, you can disable the collection of any or all .NET events. To decrease clutter in the IntelliTrace window, you might want to disable collection of events that do not interest you. Enabling or disabling the collecting of specific events generally has little effect on application performance.

IntelliTrace is enabled by default in Visual Studio 2010 Ultimate. During a live debugging session, IntelliTrace operates in the background, collecting IntelliTrace information automatically and invisibly. The availability of this information enables you to switch from the live debugging session to debugging with IntelliTrace and "time travel" through your code. The information that is collected during live debugging is also saved to an IntelliTrace file, which you can open later to start an IntelliTrace session. Debugging with Intellitrace is really comfortable for QA teams and for developers. This feature available only in Ultimate edition of Visual Studio that is only one disadvantage of it for now.



We can do more things with IntelliTrace.. you can right-click any line and search for that line or method in IntelliTrace call information. You can set the debugger context in all the call locations(call sites) from where the current exception triggering code got reached. You can share the IntelliTrace information with colleagues by giving them the .itrace file stored in the path you choose in IntelliTrace options and they can load this file and start debugging the exception(but I was able to open the corresponding source solution/file only when it is present in the same location, I mean, if you have the solution in c:\MyProj, other machine should also have in same path) the .itrace file is deleted if Visual Studio is closed, so copy it before closing Visual Studio.

Also Microsoft Test Manager is launched along with Visual Studio 2010 and it is available with Ultimate/Test professional edition, Test manager can collect IntelliTrace information and the tester can attach the trace file with the issues he/she logs in Team Foundation Server! which would be a great thing, How to: Collect IntelliTrace Data to Help Debug Difficult Issues for more on this.


Debugging with IntelliTrace in Visual Studio 2010

Comments (4) -

  • Thankfully, what we are downloading here is arguably one of the best development environments available (its Microsoft...). It contains everything we need! Your download should be done, so begin the install
  • Thank you @Alice. I really enjoy everything that connected to Debugging features in Visual Studio 2010. New version of studio is really helpful for developers and time safeness.
  • IntelliTrace in Visual Studio 2010 is cool and good place to start learning new debugging features in Visual Studio ultimate.
  • Hey man, your blog rocks ! Very useful articles ! Thanks for posting
Comments are closed