开发者

Switch to other thread while debugging session in Visual C# Express 2008

开发者 https://www.devze.com 2022-12-08 12:02 出处:网络
I have app that uses two threads: one thread for regular application work and another that does some background processing. When I debug my app and have a error message displayed I click pause to ge开

I have app that uses two threads: one thread for regular application work and another that does some background processing. When I debug my app and have a error message displayed I click pause to ge开发者_高级运维t to the line when this error ocurred.

But unfortunately I'm redirected to current line of the second background thread.

My question is: how to force VC# to go on pause to line executed by my main thread?


What you can do is use the debugger to pause a particular thread. Open up the Threads window, right click on your background thread and select Pause. Then hit F5 to resume the application and since the background thread is paused, it should resume on your main thread. You can then step through your main thread uninhibitted by the background thread.

Don't forget to unpause the background thread though :).

EDIT

Hmm, it appears the Threads window is not available in Expression editions of Visual Studio (Reference). Leaving up as a CW incase someone comes across this answer with a non-express version of VS.


there is a combobox where you can chose the current thread. If not, you may have to pull this option into the toolbar first.


I think you mean, "how do you switch the displayed thread while debugging"? I could be totally misreading the question, but I think it might have something to do with the Threads window (Debug->Windows->Threads). Gives you a list of running threads, and lets you switch between them, when you're breakpointed.

0

精彩评论

暂无评论...
验证码 换一张
取 消