Exercise 2: Debugging with IntelliTrace Files from Production

In this exercise, you will see how we can use the IntelliTrace file that was generated on a production server to aid in debugging the error that we saw in the previous exercise.

  1. Returning to our scenario, let’s assume that we have already taken this IntelliTrace file and transferred it to a development machine that has Visual Studio 11 installed. Double-click on the IntelliTrace file to load it in Visual Studio 11.

    Figure 11

    Loading the IntelliTrace file

  2. In the IntelliTrace summary window, scroll down to the Exception Data section. Here you can see a grid showing all exceptions that occurred. By default, they are sorted by most recent event time to the oldest.

    Figure 12

    Exception Data section of IntelliTrace summary

  3. Select the last System.NullReferenceException found in the list, that is the technically the oldest or first one that was thrown, and then select the Start Debugging button to start an IntelliTrace debugging session.

    Figure 13

    Start debugging at a specific event

  4. After the IntelliTrace debugging session starts, you will see that the IntelliTrace pane is automatically loaded and the location in code where the exception occurred is highlighted. You now have full access to the normal suite of IntelliTrace debugging functionality.

    Figure 14

    Debugging the thrown exception

  5. In the Locals window, note that the ServiceTicket.AssignedTo property currently has a null value. This explains why referencing serviceTicket.AssignedTo.FullName in code resulted in the null reference exception that we saw. At this point, we could file a bug in Team Foundation Server and attach the IntelliTrace file to help the development team make the appropriate fix.

    Figure 15

    Finding root cause for exception