Datasheet

The true power of the Visual Studio debugger is its interactive debugging. To demonstrate this, with your
application running, select Visual Studio as the active window. Change your display to the Form1.vb Code
view (not Design view) and click in the border alongside the line of code you added to increment the count
when the button is clicked. Doing this creates a breakpoint on the selected line (refer to Figure 1 - 26). Return
to your application and then click the Hello World button. Visual Studio takes the active focus, returning
you to the code window, and the line with your breakpoint is now selected.
Visual Studio 2010 introduces a new window that is located in the same set of tabs as the Solution Explorer.
As shown in Figure 1 - 26, the IntelliTrace window tracks your actions as you work with the application in
Debug mode. Figure 1 - 27 focuses on this new feature available to the Ultimate edition of Visual Studio.
Sometimes referred to as historical debugging , the IntelliTrace window provides a history of how you got to a
given state.
FIGURE 1 - 27
When an error occurs during debugging, your fi rst thought is likely to be What just happened? But how
do you reproduce that error? As indicated in Figure 1 - 27, the IntelliTrace window tracks the steps you have
taken in this case showing that I had used the Run Code button a second time since the steps shown in
Figure 1 - 26. By providing a historical trail, IntelliTrace enables you to reproduce a given set of steps through
your application. You can also fi lter the various messages either by message type or by thread.
The ability to select these past break points and review the state of variables and classes in your running
application can be a powerful tool for tracking down runtime issues. The historical debugging capabilities
are unfortunately only available in Visual Studio 2010 Ultimate, but they take the power of the Visual
Studio debugger to a new level.
However, even if you don t have the power of historical debugging, the Visual Studio debugger is a powerful
development ally. It is, arguably, more important than any of the other developer productivity features of
Visual Studio. With the execution sitting on this breakpoint, it is possible to control every aspect of your
running code. Hovering over the property
Count , as shown in Figure 1 - 28, Visual Studio provides a debug
ToolTip showing you the current value of this property. This hover over feature works on any variable
in your local environment and is a great way to get a feel for the different values without needing to go to
another window.
Windows such as Locals and Autos display similar information about your variables, and you can use
these to update those properties while the application is running. However, you ll note that the image in
Figure 1 - 28 includes a small pin symbol. Using this you can keep the status window for this variable open
in your Code view. This was done in Figure 1 - 29, and now as I step past the line where my breakpoint
was set, the information in the window is updated to show the new value of
Count . Visual Studio has just
allowed you to create a custom watch window to refl ect the value of Count .
Enhancing a Sample Application
47
CH001.indd 47CH001.indd 47 4/5/10 11:56:58 AM4/5/10 11:56:58 AM