Debugging Your Visual Basic Application

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.

Controlling Execution

The following table lists debugging tasks involving execution control and provides links to their associated Help pages.

To

See

Break execution.

How to: Break Execution

Start execution.

How to: Start Execution

Specify the configurations for the debug and release versions of a program.

Debug and Release Project Configurations

Set start options (command-line arguments, working directory, remote machine)

How to: Set Start Options for Application Debugging

Debug at design time.

Walkthrough: Debugging at Design Time

Launch the debugger.

How to: Launch the Debugger Automatically

Step into only the code you have written and ignore other code, such as system calls.

How to: Step Into Just My Code

Step into code.

How to: Step Into Code

Stop debugging.

How to: Stop Debugging or Stop Execution

Enable just-in-time debugging, which launches the Visual Studio debugger when a program running outside Visual Studio encounters a fatal error.

Just-In-Time Debugging

Handling Exceptions

The following table lists debugging tasks involving exception handling and points to their associated Help pages.

To

See

Break on unhandled exceptions.

How to: Break on User-Unhandled Exceptions

Break when an exception is thrown.

How to: Break When an Exception is Thrown

Break on first-chance exceptions.

How to: Break When an Exception is Thrown

Use the exception assistant.

How to: Correct Run-Time Errors with the Exception Assistant

Add a new exception.

How to: Add New Exceptions

Continue execution after an exception has been thrown.

Continuing Execution After an Exception

Edit and Continue

The following table lists debugging tasks involving Edit and Continue and points to their associated Help pages.

To

See

Turn Edit and Continue off and on.

How to: Enable and Disable Edit and Continue

Stop Edit and Continue from applying code changes.

How to: Stop Code Changes

Apply edits in break mode.

How to: Apply Edits in Break Mode with Edit and Continue

Examining Debugging Data

The following table lists debugging tasks involving viewing debugging data and points to their associated Help pages.

To

See

Use the Registers window to display register contents.

How to: Use the Registers Window

Use the Call Stack window to view function or procedure calls that are currently on the stack.

How to: Use the Call Stack Window

Use the Disassembly window to view assembly code corresponding to the instructions created by the compiler.

How to: Use the Disassembly Window

Use the Modules window to list and describe modules used by your program.

How to: Use the Modules Window

Use the Script Explorer window to list script files that are currently loaded into the program.

How to: View Script Documents

Use the Processes window to show all processes that you have attached to or launched from Visual Studio.

How to: Use the Processes Window

Use the Threads window to examine and control threads in the program.

How to: Use the Threads Window

Setting Breakpoints

The following table lists debugging tasks involving breakpoints and points to their associated Help pages.

To

See

Set a breakpoint.

How to: Set a Simple Breakpoint

Delete a breakpoint.

How to: Delete Breakpoints

Enable or disable a breakpoint.

How to: Enable or Disable Breakpoints

Change a breakpoint location.

How to: Edit a Breakpoint Location

Use a filter to limit the behavior of a breakpoint to specified computers, processes, and threads.

How to: Specify a Breakpoint Filter

Conditionally control whether or not a breakpoint is executed.

How to: Specify a Breakpoint Condition

Use the Breakpoints window to accomplish breakpoint-related tasks.

How to: Use the Breakpoints Window

See Also

Tasks

Walkthrough: Debugging a Windows Form

How to: Apply Edits in Break Mode with Edit and Continue

Concepts

Execution Control

Other Resources

Debugging Managed Code

Debugging Native Code

Debugging Web Applications and Script

Debugging User Interface Reference

Debug Settings and Preparation

Debugger Roadmap

Debugging Preparation: C#, F#, and Visual Basic Project Types