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/debug-multithreaded-applications-in-visual-studio.md
+13-5Lines changed: 13 additions & 5 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: "Debug multithreaded applications"
3
3
description: Debug multithreaded applications in Visual Studio and review tools and other articles about debugging multithreaded apps.
4
-
ms.date: "05/06/2024"
4
+
ms.date: "8/5/2025"
5
5
ms.topic: "conceptual"
6
6
f1_keywords:
7
7
- "vs.debug.gputthreads"
@@ -41,9 +41,17 @@ The existence of multiple processes enables a computer to perform more than one
41
41
42
42
Visual Studio provides different tools for use in debugging multithreaded apps.
43
43
44
-
- For threads, the primary tools for debugging threads are the **Threads** window, thread markers in source windows, the **Parallel Stacks** window, the **Parallel Watch** window, and the **Debug Location** toolbar. To learn about the **Threads** window and **Debug Location** toolbar, see [Walkthrough: Debug using the Threads window](../debugger/how-to-use-the-threads-window.md). To learn how to use the **Parallel Stacks** and **Parallel Watch** windows, see [Get started debugging a multithreaded application](../debugger/get-started-debugging-multithreaded-apps.md). Both topics show how to use thread markers.
44
+
::: moniker range=">= vs-2022"
45
+
- For threads, the primary tools for debugging threads are the **Parallel Stacks** window, the **Parallel Watch** window, thread markers in source windows, the **Threads** window, and the **Debug Location** toolbar. To learn about the **Threads** view in **Parallel Stacks**, see [Debug a deadlock using Threads view](../debugger/how-to-use-the-threads-window.md). To learn how to use the **Parallel Stacks** and **Parallel Watch** windows, see [Get started debugging a multithreaded application](../debugger/get-started-debugging-multithreaded-apps.md). The get started article shows how to use thread markers. Also, see [Walkthrough: Debugging a C++ AMP application](/cpp/parallel/amp/walkthrough-debugging-a-cpp-amp-application).
45
46
46
-
- For code that uses the [Task Parallel Library (TPL)](/dotnet/standard/parallel-programming/task-parallel-library-tpl) or the [Concurrency Runtime](/cpp/parallel/concrt/concurrency-runtime/), the primary tools for debugging are the **Parallel Stacks** window, the **Parallel Watch** window, and the **Tasks** window, which also supports JavaScript. To get started, see [Walkthrough: Debugging a parallel application](../debugger/walkthrough-debugging-a-parallel-application.md) and [Walkthrough: Debugging a C++ AMP application](/cpp/parallel/amp/walkthrough-debugging-a-cpp-amp-application).
47
+
- For .NET code that uses async, the primary tools for debugging are **Tasks** view in the **Parallel Stacks** window. To get started, see [Debug an async application (.NET)](../debugger/walkthrough-debugging-a-parallel-application.md).
48
+
::: moniker-end
49
+
50
+
::: moniker range="vs-2019"
51
+
- For threads, the primary tools for debugging threads are the **Parallel Stacks** window, the **Parallel Watch** window, thread markers in source windows, the **Threads** window, and the **Debug Location** toolbar. To learn about the **Threads** view in **Parallel Stacks**, see [View threads and tasks in the Parallel Stacks window](../debugger/using-the-parallel-stacks-window.md). To learn how to use the **Parallel Stacks** and **Parallel Watch** windows, see [Get started debugging a multithreaded application](../debugger/get-started-debugging-multithreaded-apps.md). The get started article shows how to use thread markers. Also, see [Walkthrough: Debugging a C++ AMP application](/cpp/parallel/amp/walkthrough-debugging-a-cpp-amp-application).
52
+
53
+
- For .NET code that uses async, the primary tools for debugging are **Tasks** view in the **Parallel Stacks** window. For more information, see [View threads and tasks in the Parallel Stacks window](../debugger/using-the-parallel-stacks-window.md).
54
+
::: moniker-end
47
55
48
56
- For debugging threads on the GPU, the primary tool is the **GPU Threads** window. See [How to: Use the GPU Threads window](../debugger/how-to-use-the-gpu-threads-window.md).
49
57
@@ -59,11 +67,11 @@ Debugging a multithreaded application that has a user interface can be especiall
|**Attach to Process** dialog box|Available Processes you can attach to:<br /><br /> - Process name (.exe)<br />- Process ID number<br />- Menubar Title<br />- Type (Managed v4.0; Managed v2.0, v1.1, v1.0; x86; x64; IA64)<br />- User Name (account name)<br />- Session number|Select a process to attach to<br /><br /> Select a remote computer<br /><br /> Change transport type for connecting to remote computers|
61
69
|**Processes** window|Attached Processes:<br /><br /> - Process Name<br />- Process ID number<br />- Path to process .exe<br />- Menubar Title<br />- State (Break. Running)<br />- Debugging (Native, Managed, and so on.)<br />- Transport type (default, native with no authentication)<br />- Transport Qualifier (remote computer)|Tools:<br /><br /> - Attach<br />- Detach<br />- Terminate<br /><br /> Shortcut menu:<br /><br /> - Attach<br />- Detach<br />- Detach when debugging stopped<br />- Terminate|
62
-
|**Threads** window|Threads in current process:<br /><br /> - Thread ID<br />- Managed ID<br />- Category (main thread, interface thread, remote procedure call handler, or worker thread)<br />- Thread Name<br />- Location where thread is created<br />- Priority<br />- Affinity Mask<br />- Suspended Count<br />- Process Name<br />- Flag Indicator<br />- Suspended indicator|Tools:<br /><br /> - Search<br />- Search Call Stack<br />- Flag Just My Code<br />- Flag Custom Module Selection<br />- Group by<br />- Columns<br />- Expand/Collapse callstacks<br />- Expand/Collapse groups<br />- Freeze/Thaw Threads<br /><br /> Shortcut menu:<br /><br /> - Show threads in source<br />- Switch to a thread<br />- Freeze a running thread<br />- Thaw a frozen thread<br />- Flag a thread for additional study<br />- Unflag a thread<br />- Rename a thread<br />- Show and hide threads<br /><br /> Other actions:<br /><br /> - View the call stack for a thread in a DataTip|
63
-
|Source window|Thread indicators in left gutter indicate single or multiple threads (off by default, turned on by using shortcut menu in **Threads** window)|Shortcut menu:<br /><br /> - Switch to a thread<br />- Flag a thread for additional study<br />- Unflag a thread|
64
70
|**Debug Location** toolbar|- Current process<br />- Suspend the application<br />- Resume the application<br />- Suspend and shut down the application<br />- Current thread<br />- Toggle current thread flag state<br />- Show only flagged threads<br />- Show only current process<br />- Current stack frame|- Switch to another process<br />- Suspend, resume, or shut down the application<br />- Switch to another thread in current process<br />- Switch to another stack frame in current thread<br />- Flag or unflag current threads<br />- Show only flagged threads<br />- Show only the current process|
65
71
|**Parallel Stacks** window|- Call stacks for multiple threads in one window.<br />- Active stack frame for each thread.<br />- Callers and callees for any method. <br/>- Deadlock Detection <br />|- Filter out specified threads <br />- Filter out external code stacks<br />- Switch to Tasks view<br />- Flag or unflag a thread<br />- Zoom <br />- Copy Stack Frames <br />- Save/Export all stacks as image |
66
72
|**Parallel Watch** window|- The flag column, in which you can mark a thread that you want to pay special attention to.<br />- The frame column, in which an arrow indicates the selected frame.<br />- A configurable column that can display the machine, process, tile, task, and thread.|- Flag or unflag a thread<br />- Display only flagged threads<br />- Switch frames<br />- Sort a column<br />- Group threads<br />- Freeze or thaw threads<br />- export the data in the Parallel Watch window|
73
+
|**Threads** window|Threads in current process:<br /><br /> - Thread ID<br />- Managed ID<br />- Category (main thread, interface thread, remote procedure call handler, or worker thread)<br />- Thread Name<br />- Location where thread is created<br />- Priority<br />- Affinity Mask<br />- Suspended Count<br />- Process Name<br />- Flag Indicator<br />- Suspended indicator|Tools:<br /><br /> - Search<br />- Search Call Stack<br />- Flag Just My Code<br />- Flag Custom Module Selection<br />- Group by<br />- Columns<br />- Expand/Collapse callstacks<br />- Expand/Collapse groups<br />- Freeze/Thaw Threads<br /><br /> Shortcut menu:<br /><br /> - Show threads in source<br />- Switch to a thread<br />- Freeze a running thread<br />- Thaw a frozen thread<br />- Flag a thread for additional study<br />- Unflag a thread<br />- Rename a thread<br />- Show and hide threads<br /><br /> Other actions:<br /><br /> - View the call stack for a thread in a DataTip|
74
+
|Source window|Thread indicators in left gutter indicate single or multiple threads (off by default, turned on by using shortcut menu in **Threads** window)|Shortcut menu:<br /><br /> - Switch to a thread<br />- Flag a thread for additional study<br />- Unflag a thread|
67
75
|**Tasks** window|- View information about <xref:System.Threading.Tasks.Task> objects including task ID, task status (scheduled, running, waiting, deadlocked), and which thread is assigned to the task.<br />- Current location in call stack.<br />- Delegate passed to the task at creation time|- Switch to current task<br />- Flag or unflag a task<br />- Freeze or thaw a task|
68
76
|**GPU Threads** window|- The flag column, in which you can mark a thread that you want to pay special attention to.<br />- The current thread column, in which a yellow arrow indicates the current thread.<br />- The **Thread Count** column, which displays the number of threads at the same location.<br />- The **Line** column, which displays the line of code where each group of threads is located.<br />- The **Address** column, which displays the instruction address where each group of threads is located.<br />- The **Location** column, which is the location in the code of the address.<br />- The **Status** column, which shows whether the thread is active or blocked.<br />- The **Tile** column, which shows the tile index for the threads in the row.|- Change to a different thread<br />- Display a particular tile and thread<br />- Display or hide a column<br />- Sort by a column<br />- Group threads<br />- Freeze or thaw threads<br />- Flag or unflag a thread<br />- Display only flagged threads|
0 commit comments