Exercise 1: Introduction to IntelliTrace

In this exercise, you will be see how the default settings for IntelliTrace can help debug an XML data failure on an ASP.NET website.

Supported applications and debugging scenarios:

IntelliTrace supports debugging Visual Basic and C# applications that use .NET version 2.0, 3.0, 3.5, or 4 (ASP.NET, Windows Forms, WPF, Windows Workflow, and WCF). IntelliTrace does not support debugging C++, script, or non-managed languages. For more detailed information about IntelliTrace support, please refer to the Visual Studio 2010 documentation on the Microsoft Developer Network (https://msdn.microsoft.com).

  1. Log in as Abu Obeida Bakhach (Dev) if you have not already done so. The password is P2ssw0rd (capital letter P, the number two, the letter s, the letter s, the letter w, the number zero, the letter r, and the letter d). Please see “Working with the Visual Studio 2010 Virtual Machine” for instructions on how to log into the VM.
  2. Open Microsoft Visual Studio from Start | All Programs | Microsoft Visual Studio 2010 | Microsoft Visual Studio 2010.
  3. In Source Control Explorer (View | Other Windows | Source Control Explorer), navigate to Tailspin Toys | Development | Iteration 2 and double-click on the TailspinToys.sln file to open the Tailspin Toys solution.
  4. Rebuild the solution (Build | Rebuild Solution from the main menu). This step may take a few minutes to complete.
  5. Open the Options window from Tools | Options... and click on the IntelliTrace node.
  6. Ensure that the Enable IntelliTrace checkbox is checked and that it is set to “IntelliTrace events only”. This is the default setting because it has minimal performance implications.

    Figure 1

    IntelliTrace options

    Note:
    IntelliTrace records events to a IntelliTrace file, which has an .iTrace extension. These files can be saved and used later in order to perform debugging with IntelliTrace, enabling testers to attach this detailed debugging information directly to bug reports.
  7. Start a debugging session by pressing F5. This will load the default page for the fictional Tailspin Toys company.

    Note:
    If the Tailspin.Web project is not set as the startup project, right-click on the Tailspin.Web node in Solution Explorer and select the “Set as StartUp Project” option.

    Figure 2

    Tailspin Toys Default page

  8. Select the About Us link in the footer of the page. This will generate an exception and show a custom ASP.NET error page for the Tailspin Toys application.

    Figure 3

    Error page shown when loading About Us

  9. Switch back to Visual Studio and select Debug | Break All so that we can begin the debugging process. If the IntelliTrace window is not visible, open it by selecting Debug | Windows | IntelliTrace Events from the main menu. The IntelliTrace Events window shows a sequential list of events that have been collected since you started the debugging session, with the most recent being at the bottom.

    Figure 4

    IntelliTrace window showing recorded events

    Note:
    IntelliTrace is by default configured to collect certain events when debugging, some of which you can see in the IntelliTrace Events window now. You can configure which event categories or even specific events are collected in the IntelliTrace options node (Tools | Options).
  10. In the IntelliTrace Events window, locate and select the “Exception Thrown” event that occurs after the ‘/Views/Home/About” page is loaded. This will show details about the exception that occurred, as well as provide links to the Locals and Call Stack windows. This exception lets us know that there is a problem with an XML file on line 10, column 49, but it does not tell us which XML file this is in referring to.

    Figure 5

    Exception thrown when parsing an XML file

    Figure 6

    Locals and Call Stack windows state during selected exception

  11. Select the “XML Loading” event immediately preceding the exception to see the file that was accessed just before the exception occurred.

    Figure 7

    XML loading event

  12. Open the Ads.xml file by clicking on the provided link and navigating to the Tailspin.Web\Content\XML\Ads.xml file and selecting the Open button.
    Note:
    You will need to navigate to the Iteration 2 folder at c:\ws\abuobe\Tailspin Toys\Development\Iteration 2.
  13. Observe that there is a red squiggly line under the “&b=1” characters which are invalid in this context. Note that this is on line 10, column 49 just as we expected from the XML exception.

    Figure 8

    Ads.xml showing invalid characters

  14. Remove the invalid characters and save the file. The final URL should be https://localhost/test.aspx?a=2.
    Note:
    Select the Edit button when prompted by the Edit and Continue window.
  15. Press F5 twice to continue running the application.
  16. Switch back to Internet Explorer and click the About Us link again to verify that the problem is now fixed. The bottom of the About page shows one of the ads that is specified in the Ads.xml file.

    Figure 9

    About page with working ad

  17. Stop the current debugging session (Debug | Stop Debugging).

Next Step

Exercise 2: Using IntelliTrace with Call Information