This documentation is archived and is not being maintained.

Using the Debugger

The Visual Studio .NET debugger is a powerful tool that allows you to observe the run-time behavior of your program and determine the location of semantic errors. The debugger understands features that are built into programming languages and their associated libraries. With the debugger, you can break (suspend) execution of your program to examine your code, evaluate and edit variables in your program, view registers, see the instructions created from your source code, and view the memory space used by your application.

The Visual Studio debugger provides menu items, windows, and dialog boxes to access all its tools. You can obtain help on any window, dialog box, or control by selecting the item and pressing F1. You can also drag and drop to move debugging information between windows.

In This Section

Debugging Basics
Provides introductory information on the types of errors code can contain, the importance of testing, and the process of debugging. This section also includes descriptions of several debugger features: the Disassembly window, the Memory window, the Registers window, breakpoints, and the QuickWatch dialog box.
Execution Control
Provides links to topics describing the debugger commands you can use to control the execution of your application. Using these commands, you can start (or continue) execution, break execution, stop execution, step through your application, run to a specified location, and set the execution point.
Attaching to a Running Program or Multiple Programs
Describes how to attach to programs that are running in processes outside of Visual Studio. You can use this attach capability to: debug a program that was not created in Visual Studio, debug multiple programs simultaneously, debug a program running on a remote machine, debug a DLL that runs in a separate process that cannot easily be started from Visual Studio, and start the debugger automatically when a program crashes while running outside of Visual Studio.
Just-In-Time Debugging
Discusses Just-In-Time debugging (a technique for debugging a program that is started outside of Visual Studio). This topic also provides instructions for enabling Just-In-Time debugging.
Launching the Debugger Automatically
Provides instructions on setting up your application to start Visual Studio when you start the application from Windows. Visual Studio will load your application, ready for debugging, but debugging will not begin until you issue an execution command. Launching the debugger in this way is useful for debugging services and COM out-of-proc servers.
Describes dump files, including instructions on saving and opening. Dumps can be useful if you are testing a program on a machine that does not have source files or PDBs installed. When a crash occurs, you can save a dump file and debug it later on the machine that has the source files and PDBs.
Describes what breakpoints are, the types of breakpoints, properties of breakpoints (hit count and condition), and provides instructions for enabling, disabling, removing, inserting, and editing breakpoints in various debugger windows. The first topic in this section also provides cautionary information about setting breakpoints on system components when you are debugging mixed-mode (native and managed code).
Debugging Tools for Inspecting Your Program
Provides information on a variety of debugging tools that enable you to inspect and modify the state of your program. Most of these tools function only in break mode.
Handling Exceptions
Describes exceptions, how the debugger handles them and how to change that handling, how to see where the exception occurred and see the variable contents, limitations for unhandled exceptions in managed code, and fixing exceptions in native (C++) code.
Edit and Continue
Describes Edit and Continue, a tool that enables you to change your source code while your program is in break mode and apply those changes without having to end the debug session and build your program again, and provides instructions on enabling or disabling this feature.
Expressions in the Debugger
Describes the native expression evaluator in the Visual Studio debugger. This section provides links to topics that describe the language-specific syntax you can use when entering expressions in the debugger (C++, C#, Managed Extensions for C++, and Visual Basic).

Related Sections

Visual Studio Debugger Model
Provides reference material on objects, properties, methods, enumerators, events, and error codes of the debugger object model, with which you can automate many debugger features.
Debugging Home Page
Provides links to the larger sections of the debugging documentation. Information includes: what's new in the debugger, settings and preparation, breakpoints, handling exceptions, edit and continue, debugging managed code, debugging Visual C++ projects, debugging COM and ActiveX, debugging DLLs, debugging SQL, and the user interface references.