Share via


View threads and tasks in the Parallel Stacks window (C#, Visual Basic, C++)

The Parallel Stacks window is useful for debugging multithreaded applications. It has several views:

  • Threads view shows call stack information for all threads in the app. You can navigate between threads and stack frames on those threads.
  • Method View pivots the call stack on a selected method.

Use the Parallel Stacks window

To open the Parallel Stacks window, you must be in a debugging session. Select Debug > Windows > Parallel Stacks.

Toolbar controls

The Parallel Stacks window has the following toolbar controls:

Stack Frame icons

The following icons provide information about the active and current stack frames in all views:

Context menu items

The following shortcut menu items are available when you right-click a method in Threads view or Tasks view. The last six items are the same as in the Call Stack window.

Threads view

In Threads view, the stack frame and call path of the current thread are highlighted in blue. The current location of the thread is shown by the yellow arrow.

To change the current stack frame, double-click a different method. This might also switch the current thread, depending on whether the method you select is part of the current thread or another thread.

When the Threads view graph is too large to fit into the window, a Bird's Eye View control appears in the window. You can move the frame in the control to navigate to different parts of the graph.

Tasks view

For .NET apps using the async/await pattern, the Tasks view is the most helpful for debugging. For a step-by-step tutorial, see Debug an async application.

In Tasks view, you can:

  • View call stack visualizations for apps that use the async/await pattern.
  • Identify async code that is scheduled to run but isn't yet running.

The following illustration shows the Threads view at the top and the corresponding Tasks view at the bottom.

Hover over a method to show a tooltip with additional information. In Tasks view, the tooltip shows all the tasks in a table similar to the Tasks window.

The following image shows the tooltip for a method in the Threads view at the top and for the corresponding Tasks view at the bottom.

Method View

From either Threads view or Tasks view, you can pivot the graph on the current method by selecting the Toggle Method View icon on the toolbar. Method View shows at a glance all methods on all threads that either call or are called by the current method. The following illustration shows how the same information looks in Threads view on the left and in Method View on the right.

If you switch to a new stack frame, you make that method the current method, and Method View shows all callers and callees for the new method. This scenario might cause some threads to appear or disappear from the view, depending on whether that method appears on their call stacks. To return to the call stack view, select the Method View toolbar icon again.

Debug threads and tasks with parallel stacks video tutorial

These video tutorials demonstrate how you can use the Threads and Tasks views of the Parallel Stacks window in Visual Studio 2022 to debug your multithreaded applications.