Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get Visual Studio to stay on one thread when debugging?

When I am debugging within Visual Studio, for some reason when debugging a certain thread, Visual Studio will just jump around to different threads.

How do I change to behavior so it sits on the same thread?

like image 480
rid00z Avatar asked Jul 01 '09 00:07

rid00z


People also ask

Is Visual Studio single thread?

Presentation. This Visual Studio extension adds two shortcuts and toolbar buttons to allow developers to easily focus on single threads while debugging multi-threaded applications.

How do I Debug multiple threads in Visual Studio?

Tools for debugging multithreaded apps Visual Studio provides different tools for use in debugging multithreaded apps. 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.


1 Answers

When you say, "when debugging a certain thread, visual studio will just jump around randomly to different threads", do you mean that as you step through code on a particular thread you may hit a breakpoint on a different thread?

If so, you can use the Thread window to 'freeze' threads other than the one you're interested in debugging:

From http://msdn.microsoft.com/en-us/library/w15yf86f.aspx:

From the Threads window, you can set the active thread. In addition, you can freeze or thaw the execution of each individual thread. Freezing prevents the execution of a thread. Thawing enables it to continue. Two vertical blue bars identify a frozen thread.

Support for this may depend on the version of Visual Studio you have (for example, I don't think the Express versions support the Thread window).

like image 127
Michael Burr Avatar answered Sep 20 '22 05:09

Michael Burr