开发者

How to debug a threadpool in Visual Studio?

I'm quite new to the multithreading environment and I'm having trouble debugging an application which makes use of a threadpool created by the elapsed event in System.Timers.timer class. I have a breakpoint set inside a method which is called eac开发者_如何学Pythonh time by the elapsed event, but Visual Studio's is jumping between lines of code because it is indicating the actions of the other threads.

How do I debug through a method, from start to finish on a particular thread without Visual Studio alerting me of other threads? Can Visual Studio stop all threads and let me debug from a chosen thread?


Few links

  • Parallel Diagnostic tools
  • Parallel Debugging Visual Studio 2010
  • Debugging A parallel application

    How to debug a threadpool in Visual Studio?


It is possible to suspend other threads while debugging and let only the thread you care about run.

  • Open the Threads Window in Visual Studio (Debug -> Windows -> Threads)
  • Right click on any thread you don't want to run and select "Freeze"
  • Continue debugging.

Don't forget to unfreeze the threads when you are done debugging your particular thread.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜