Reputation: 1716
When I'm debugging managed, multi-threaded code and I'm at a breakpoint in the Main\UnitTestRunner thread and start single stepping occasionally the debugger will switch to another thread and start stepping it's code. How can I stop this?
Using VS2010 + Resharper 5.1 if it matters.
Update 1:
A closer look at the stack after a single step (F10) command shows that many (10-30) steps were actually performed before the debugger decided to stop execution.
This is happening regularly enough to make debugging nearly impossible. This is scarily similar to the issue Hans referred to.
Update 2:
I've filed a bug on Microsoft Connect. Please "upvote" it if you are also having this issue.
Update 3:
Confirmed by M$ as a bug to be fixed in the next "servicing release." Workaround is to target unit tests to .NET 3.5 as described here.
Upvotes: 4
Views: 2895
Reputation: 1
If you are on a 64-bit operating system, ensure your debugger settings are set to default to a 64-bit process. Under Debug -> Options and Settings -> TestDriven.Net -> General, make sure that "Any CPU tests" is set to Run in 64-bit process.
Upvotes: 0
Reputation: 54128
In addition to Brian's answer - if the code in your threads does not overlap, you can click on the next line at which you want to stop and hit "Run to Cursor"
Upvotes: 0
Reputation: 347216
You can go to the thread view and freeze the other threads.
Debug -> Windows -> Threads
Then right click on the threads you want to Freeze and select Freeze. When you want that thread to be used again right click the thread and select Thaw.
Upvotes: 7