
Debugging | 221
Error Handling
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
To start a debugging session with either debugger, follow these basic steps:
1. Open the debugger (or the Visual Studio .NET IDE).
2. Open the project or files you wish to debug.
3. Ensure that debugging is enabled for all pages and classes that you wish to
debug.
4. Set breakpoints in the source code that will halt execution at a chosen point
and allow you to step through subsequent code.
5. Start the debugger, either by attaching to running processes for your applica-
tion (the key process being the aspnet_wp.exe process) or by running the Debug
Start command in the Visual Studio .NET IDE. Note that you may need to set
the desired start page as described in “Using the Visual Studio .NET
Debugger,” later in this chapter.
The key to debugging in either debugger is ensuring that all code to be debugged
is compiled in debug mode. This mode inserts symbols into the compiled assem-
blies that allow the debuggers to attach to the running code and allows you to
step through this code line by line.
In the next two sections we’ll look at the specific steps taken to enable debug
mode, start debugging sessions, and step through code in both debuggers.
Using the SDK Debugger
Debugging in the SDK debugger, DbgCLR.exe, is fairly straightforward. The
program is located by ...