Reputation: 131112
When debugging multi threaded .NET apps in VS (2008) I frequently want to step through code. When I press F10 quite often I find VS jumping to a statement in another thread. Its really confusing and always throws me off.
I can work around it by chucking in a million breakpoints.
Is there a cleaner way of asking VS debugger to go to the next statement in the current thread?
Upvotes: 4
Views: 665
Reputation: 131112
John Robbins, an authority on Windows debugging, just posted a macro that allows you to freeze and thaw threads in bulk in VS 2008.
This certainly makes things much easier. Thread inter-dependencies may end up causing issues, nonetheless this is a workable solution most of the time.
Upvotes: 2
Reputation: 118865
Agree with @Alan McBee. I think in VS 2010 they're adding a 'freeze all threads except this one' command, which will make this easier, too. But I think there's no other way to achieve your goal (e.g. must either freeze threads or set breakpoints).
Upvotes: 0
Reputation: 4320
Probably a much simpler way would be to Freeze any thread that you're not interested in tracing (right click in the Threads window). This may mean a little manual manipulation for you, and won't accurately represent thread interaction, but you won't jump from one thread to the next.
Upvotes: 3