|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Debugging Your Visual Basic Application
Updated: August 2008
This page provides pointers to documentation for the debugging features built into Visual Studio.
You can use the most important of these, the debugger, to observe the run-time behavior of your program and to determine the location of semantic errors.
Using the debugger, you can examine the content of variables in your program without inserting additional calls to output the values. Similarly, you can insert a breakpoint in your code to halt execution at the desired point.
The following table lists debugging tasks involving execution control and provides links to their associated Help pages.
Set start options (command-line arguments, working directory, remote machine)
Debug at design time.
Launch the debugger.
Step into only the code you have written and ignore other code, such as system calls.
Step into code.
Enable just-in-time debugging, which launches the Visual Studio debugger when a program running outside Visual Studio encounters a fatal error.
The following table lists debugging tasks involving exception handling and points to their associated Help pages.
Break on unhandled exceptions.
Break when an exception is thrown.
Break on first-chance exceptions.
Use the exception assistant.
Add a new exception.
Continue execution after an exception has been thrown.
The following table lists debugging tasks involving Edit and Continue and points to their associated Help pages.
Turn Edit and Continue off and on.
Stop Edit and Continue from applying code changes.
Apply edits in break mode.
The following table lists debugging tasks involving viewing debugging data and points to their associated Help pages.
Use the Registers window to display register contents.
Use the Call Stack window to view function or procedure calls that are currently on the stack.
Use the Disassembly window to view assembly code corresponding to the instructions created by the compiler.
Use the Modules window to list and describe modules used by your program.
Use the Script Explorer window to list script files that are currently loaded into the program.
Use the Processes window to show all processes that you have attached to or launched from Visual Studio.
Use the Threads window to examine and control threads in the program.
The following table lists debugging tasks involving breakpoints and points to their associated Help pages.
Set a breakpoint.
Delete a breakpoint.
Enable or disable a breakpoint.
Change a breakpoint location.
Use a filter to limit the behavior of a breakpoint to specified computers, processes, and threads.
Conditionally control whether or not a breakpoint is executed.
Use the Breakpoints window to accomplish breakpoint-related tasks.