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/how-to-use-the-threads-window.md
+16-13Lines changed: 16 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ manager: douge
20
20
ms.workload:
21
21
- "multiple"
22
22
---
23
-
# Walkthrough: Debug a multithreaded app
23
+
# Walkthrough: Debug a multithreaded app using the Threads window
24
24
25
25
Several Visual Studio user interface elements help you debug multithreaded apps. This article introduces multithreaded debugging features in the code editor window, **Debug Location** toolbar, and **Threads** window. For information about other tools for debugging multithreaded apps, see [Get started debugging multithreaded apps](../debugger/get-started-debugging-multithreaded-apps.md).
26
26
@@ -32,13 +32,15 @@ Create the following multithreaded app project to use in this tutorial:
32
32
33
33
1. In Visual Studio, select **File** > **New** > **Project**.
34
34
35
-
1. In the **New Project** dialog box, select **Visual C#** > **Console App (.NET Framework)**.
35
+
1. In the **New Project** dialog box:
36
+
- For a C# app, select **Visual C#** > **Console App (.NET Framework)**.
37
+
- For a C++ app, select **Visual C++** > **Windows Console Application**.
36
38
37
39
1. Name the app MyThreadWalkthroughApp, and then select **OK**.
38
40
39
-
The new project appears in **Solution Explorer**, and a source file called *Program.cs* opens in the source code window.
41
+
The new project appears in **Solution Explorer**, and a source file called *Program.cs*or *MyThreadWalkthroughApp.cpp*opens in the source code window.
40
42
41
-
1. Replace the code in the source file with the example code from [Create a thread](/dotnet/standard/threading/creating-threads-and-passing-data-at-start-time.md#create-a-thread).
43
+
1. Replace the code in the source file with the C# or C++ example code from [Get started debugging multithreaded apps](../debugger/get-started-debugging-multithreaded-apps.md).
42
44
43
45
1. Select **File** > **Save All**.
44
46
@@ -47,11 +49,16 @@ Create the following multithreaded app project to use in this tutorial:
47
49
1. Find the following lines in the source code:
48
50
49
51
```csharp
50
-
Thread.Sleep(3000);
51
-
Console.WriteLine();
52
+
Thread.Sleep(3000);
53
+
Console.WriteLine();
52
54
```
53
55
54
-
Set a breakpoint on the `Console.WriteLine();` line by clicking in the left gutter, or selecting the line and pressing **F9**.
56
+
```C++
57
+
Thread::Sleep(3000);
58
+
Console.WriteLine();
59
+
```
60
+
61
+
1. Set a breakpoint on the `Console.WriteLine();` line by clicking in the left gutter, or selecting the line and pressing **F9**.
55
62
56
63
The breakpoint appears as a red circle in the left gutter next to the code line.
57
64
@@ -63,13 +70,9 @@ Create the following multithreaded app project to use in this tutorial:
63
70
64
71
## Examine thread markers
65
72
66
-
1. In the source code, locate the following line:
67
-
68
-
```csharp
69
-
Thread.Sleep(3000);
70
-
```
73
+
1. In the source code, locate the `Console.WriteLine();` line.
71
74
72
-
1. Right-click in the **Threads** window, and select **Show Threads in Source** from the menu.
75
+
1. Right-click in the **Threads** window, and select **Show Threads in Source**  from the menu.
73
76
74
77
The gutter next to the source code line now displays a *thread marker* icon . The thread marker indicates that a thread is stopped at this location. If there is more than one stopped thread at the location, the  icon appears.
0 commit comments