Deep Dive into IntelliTrace using Visual Studio 2013 for ASP.NET & other .NET Applications

Posted by: Gouri Sohoni , on 10/21/2013, in Category Visual Studio, VSTS & TFS
Views: 24719
Abstract: Using IntelliTrace in Visual Studio 2013 helps in understanding and pinpointing any problem encountered while executing any ASP.NET & other .NET applications

In our previous article IntelliTrace using Visual Studio 2013 Preview we discussed how IntelliTrace in Visual Studio 2013 helps in debugging. In this article, we will find out how “.iTrace” files can be created using Microsoft Test Manager and later debugged using Visual Studio. We will also find out the steps for debugging in production environment.

A tester tests the application and files a bug. The developer tries to find out how the bug popped up and here is a challenge, as at times it becomes difficult for a developer to completely understand the error encountered by the tester. In order to provide more information to the developer about the problem, Microsoft Test Manager supports various diagnostic data adapters. One of the adapters is to configure IntelliTrace events and calls information.

 

The test setting which captures IntelliTrace events is created and used by the tester while executing the test case.

data-and-diagnostics

 

The above diagram shows the adapter for IntelliTrace. The different options are very similar as we have already seen in the previous article which is available with Visual Studio.

configure-diagnostics

Observe the check box for collecting data from ASP.NET applications running IIS. If the application under test is a Web Application, this will be useful. With Modules tab, we can decide from which modules the information should be collected.

configure-diagnostics-modules

When a tester files a bug, the “.iTrace” file automatically gets associated with it. This file can be opened by the developer in a Visual Studio environment.

bug-intellitrace

The file shows the following information in development IDE

intellitrace-summary

Exception Data: shows the recorded exceptions during execution. Each exception shows type, message.

Web Requests: provides all the web requests that were submitted to IIS pool. We can select one of the requests and click on the button for “Request Details” or double click the request. Request details provide request events and we can start debugging for a specific event. The required symbol will be loaded from the .pdb file and all the events information will be shown. We can now start debugging the application.

Threads List: lists the threads recorded while executing the application. We can start debugging the IntelliTrace event from a selected thread. Select a thread and click on Start Debugging.

intellitrace-thread-debug

Test Data: shows collected data by Microsoft Test Manager while executing the test case

System Info: detailed information about the machine on which the application was hosted.

system-info

Modules: all the modules that were loaded in the sequence.

Now we can view all events and call information from development environment and start debugging the application. Locals, Call stack window will also provide us required information.

IntelliTrace in Production Environment

Let us find out how IntelliTrace data can be collected in a production environment.

In order to debug application in an environment outside Visual Studio, we have to follow certain steps. We can collect data from ASP.NET applications hosted on IIS 7.0, 7.5 and 8.0, SharePoint 2010 and 2013 and also desktop applications written in managed code.

Following are the steps to follow

1. Install IntelliTrace Collector.
Create a folder named IntelliTraceCollector on c drive. Go to IntelliTrace Collector and find IntelliTrace collector for Visual Studio. Download IntelliTraceCollector.exe in the newly created folder. Run the file which extracts .cab file.

2. Expand the .cab file by giving following command
expand /f:* IntelliTraceCollection.cab .

intellitrace-collection-cab

3. Do not miss the period (.) which is for preserving the sub-folders.

4. Grant permission for the IntellitraceCollector to the person who will execute PowerShell cmdlets. Install IntelliTrace PowerShell cmdlets to collect data for Web Apps.

powershell-cmdlets

5. Start – All Programs – Accessories – Windows PowerShell. Enter following command

Import-Module "C:\IntelliTraceCollector\Microsoft.VisualStudio.IntelliTrace.PowerShell.dll"

run-windows-powershell

6. Create a folder for .iTrace file c:\IntelliTraceLogFiles which will collect the files.

7. To start collecting data, enter command

Start-IntelliTraceCollection “DefaultAppPool" "C:\IntelliTraceCollector\collection_plan.ASP.NET.default.xml" "C:\IntelliTraceLogFiles" IntelliTrace data collector.

If we want calls as well as events information the xml file is trace.xml. It can even be a custom file.

8. Execute the application. Stop-IntelliTraceCollection will stop the data collection.

9. Now we can open the “iTrace” file from Visual Studio environment.

10. We can create snapshot or “.iTrace” file using Checkpoint or check collection status using GET

In order to collect data in production environment without hampering the application performance you can follow these guidelines:

  • Use the collector only when there is a problem
  • When collecting for Web app, the collector records data for every app that shares the application pool. Host each application in a separate application pool
  • Edit the data collection plan to disable events which are not required
  • Include only modules in data plan which are relevant.

Using IntelliTrace helps in understanding and pinpointing any problem encountered while executing any application. The issues can then be removed and quality code can be obtained.

Give a +1 to this article if you think it was well written. Thanks!
Recommended Articles
Gouri Sohoni is a Microsoft MVP, Trainer and consultant for over two decades. She is a Microsoft Certified Trainer (MCT), MCITP and has conducted several corporate trainings on Microsoft technologies that include Visual Studio 2010 (ALM), SQL Server 2008 BI, SQL Server 2008 developer track, SQL Server 2005 BI, SQL Server 2005 developer track etc.


Page copy protected against web site content infringement by Copyscape


User Feedback

Post your comment
Name:  
E-mail: (Will not be displayed)
Comment:
Insert Cancel