Debugging multiple threads in Visual Studio is tricky, especially since these threads are all running at the same time. Luckily, we have a few tools available to us as developers to use to get a better understanding of what is happening in our multithreaded applications.
While debugging multithreaded applications, you can access various windows by going to Debug | Windows in Visual Studio.
Start debugging your multithreaded application after adding a breakpoint somewhere in the code. You can access various debugging windows by going to Debug | Windows in Visual Studio:
The first window available to you is the Threads window. Access it by going to Debug | Windows in Visual Studio or type Ctrl + Alt + H. In here, you can right-click on a thread to watch and flag it. If you have given your threads names, you will see that name appear in the Name column. To give your thread a name, you could add the following code to your application, which runs...