FAQ - Find the debugging feature you need in Visual Studio

If you need help to map your debugging task to the correct feature of the Visual Studio debugger that is relevant, use the links provided in this article. The list of tasks here includes common tasks such as pausing code to debug, inspecting variables, and sending messages to the Output window. If you need an overview of debugger features, see First look at the debugger instead.

Fix an exception

Pause running code

  • Pause running code to inspect a line of code that may contain a bug

    Set a breakpoint. For more information, see Using breakpoints.

  • Pause and inspect your app when it reaches a specific state

    Try a conditional breakpoint to control where and when a breakpoint gets activated by using conditional logic. For more information, see Breakpoint conditions.

  • Pause code only when a specific object’s property or value changes

    For C++, set a data breakpoint.

    For apps using .NET Core 3, you can also set a data breakpoint.

    Otherwise, for C# and F# only, you can track an object ID with a conditional breakpoint.

  • Pause code inside a loop at a certain iteration

    Set a breakpoint using Hit count as a condition. For more information, see Hit count.

  • Pause code at the start of a function when you know the function name but not its location

    You can do this with a function breakpoint. For more information, see Set function breakpoints.

  • Pause code at the start of multiple functions with the same name

    When you have multiple functions with the same name (overloaded functions or functions in different projects), you can use a function breakpoint.

  • Manage and keep track of your breakpoints

    Use the Breakpoints window. For more information, see Manage breakpoints.

  • Pause code and debug when a specific handled or unhandled exception is thrown

    Although the Exception Helper shows you where an error occurred, if you want to pause and debug the specific error, you can tell the debugger to break when an exception is thrown.

  • Set a breakpoint from the call stack

    If you want to pause and debug code while examining execution flow or viewing functions in the Call Stack windows, see Set a breakpoint in the Call Stack window.

  • Pause code at a specific assembly instruction

    You can do this by setting a breakpoint from the Disassembly window.

Execute code

Inspect data

Debug an app that is already running

Debug multithreaded applications

Configure debugging

  • Configure debugger settings

    To configure debugger options and debugger project settings, see Debugger settings and preparation.

  • Customize information shown in the debugger

    You may want to show information other than the object type as the value in different debugger windows. For C#, Visual Basic, F#, and C++/CLI code, use the DebuggerDisplay attribute. For more advanced options, you can also customize the UI by creating a custom visualizer.

    For native C++, use the NatVis framework.

Additional tasks