You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/debugger/get-started-with-breakpoints.md
+20-8Lines changed: 20 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Get started with breakpoints
3
3
description: Learn about breakpoints, one of the most important debugging techniques.
4
-
ms.date: 08/13/2024
4
+
ms.date: 11/22/2024
5
5
ms.topic: how-to
6
6
f1_keywords:
7
7
- vs.debug.breakpointswin
@@ -22,22 +22,30 @@ ms.author: mikejo
22
22
manager: mijacobs
23
23
ms.subservice: debug-diagnostics
24
24
---
25
-
# Use breakpoints in the Visual Studio debugger
25
+
# Get started with breakpoints in the Visual Studio debugger
26
26
27
-
Breakpoints are one of the most important debugging techniques in your developer's toolbox. You set breakpoints wherever you want to pause debugger execution. For example, you may want to see the state of code variables or look at the call stack at a certain breakpoint. If you are trying to resolve a warning or issue while using breakpoints, see [Troubleshoot breakpoints in the Visual Studio debugger](../debugger/troubleshooting-breakpoints.md).
28
-
29
-
> [!NOTE]
30
-
> If you know the task or problem you're trying to solve, but you need to know what kind of breakpoint to use, see [FAQ - Find your debugging feature](../debugger/find-your-debugging-task.yml#breakpoints).
27
+
Breakpoints are one of the most important debugging techniques in your developer's toolbox. You set breakpoints wherever you want to pause debugger execution. For example, you may want to see the state of code variables or look at the call stack at a certain breakpoint.
31
28
32
29
## <aname="BKMK_Overview"></a> Set breakpoints in source code
33
30
34
-
You can set a breakpoint on any line of executable code. For example, in the following C# code, you could set a breakpoint on the line of code with the variable assignment (`int testInt = 1`), the `for` loop, or any code inside the `for` loop. You can't set a breakpoint on method signatures, declarations for a namespace or class, or variable declarations if there's no assignment and no getter/setter.
31
+
You can set a breakpoint on any line of executable code. For example, take a look at this simple C# code that creates a simple loop.
32
+
33
+
```csharp
34
+
inttestInt=3;
35
+
36
+
for (inti=0; i<10; i++)
37
+
{
38
+
testInt+=i;
39
+
}
40
+
```
41
+
42
+
You could set a breakpoint on the line of code with the variable assignment (`int testInt = 3`), the `for` loop, or any code inside the `for` loop. You can't set a breakpoint on method signatures, declarations for a namespace or class, or variable declarations if there's no assignment and no getter/setter.
35
43
36
44
To set a breakpoint in source code:
37
45
38
46
- Click in the far left margin next to a line of code. You can also select the line and press **F9**, select **Debug** > **Toggle Breakpoint**, or right-click and select **Breakpoint** > **Insert breakpoint**. The breakpoint appears as a red dot in the left margin.
39
47
40
-
For most languages including C#, breakpoint and current execution lines are automatically highlighted. For C++ code, you can turn on highlighting of breakpoint and current lines by selecting **Tools** (or **Debug**) > **Options** > **Debugging** > **Highlight entire source line for breakpoints and current statement (C++ only)**.
48
+
For most languages, including C#, Visual Studio automatically highlights breakpoint and current execution lines. For C++ code, you can turn on highlighting of breakpoint and current lines by selecting **Tools** (or **Debug**) > **Options** > **Debugging** > **Highlight entire source line for breakpoints and current statement (C++ only)**.
41
49
42
50
::: moniker range=">= vs-2022"
43
51

@@ -70,6 +78,10 @@ Here are a few general instructions for working with breakpoints.
70
78
71
79
- Set conditions and actions, add and edit labels, or export a breakpoint by right-clicking it and selecting the appropriate command, or hovering over it and selecting the **Settings** icon.
72
80
81
+
## Types of breakpoints
82
+
83
+
Visual Studio supports different types of breakpoints to support different debugging scenarios, such as conditional breakpoints that only activate based on specified criteria. For more information, see [Use the right type of breakpoint](../debugger/using-breakpoints.md).
84
+
73
85
## <aname="BKMK_Specify_advanced_properties_of_a_breakpoint_"></a> Manage breakpoints in the Breakpoints window
74
86
75
87
You can use the **Breakpoints** window to see and manage all the breakpoints in your solution. This centralized location is especially helpful in a large solution, or for complex debugging scenarios where breakpoints are critical.
0 commit comments