Debugging

Tracing provides you with a snapshot of the steps your code has taken after the code has run. At times, however, you’d probably like to monitor your code while it is running. What you want is more of a CAT scan than an autopsy. The code equivalent of a CAT scan is a symbolic debugger.

When you run your code in the debugger, you can literally watch your code work, step by step. As you walk through the code, you can see the variables change values, and you can watch as objects are created and destroyed.

This section will provide a brief introduction to the most important parts of the debugger that accompanies the Visual Studio .NET Integrated Development Environment (IDE). For complete coverage of how to use the Visual Studio .NET debugger, we urge you to spend time with the documentation and to experiment freely. The debugger is one of the most powerful tools at your disposal for learning ASP.NET.

The Debug Toolbar

There is a Debugtoolbar available in the IDE. To make it visible, click on the View/Toolbars menu commands, then click on Debug, if it is not already checked. Table 7-3 shows the icons that appear on the Debug toolbar.

Table 7-3. Debug toolbar icons

Icon

Debug menu equivalent

Keyboard shortcut

Description

Debug toolbar icons

Toolbar handle. Click and drag to move the toolbar to a new location.

Start / Continue

F5

Starts or continues executing the program.

Get Programming ASP .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.