Zytan said:
I have code running in the debugger as I type. I press pause, and it
pauses on:
Application.Run(new myForm());
That's because in that thread, that's the location within your own code
where the thread is executing. If you'd managed to break during the
processing of an event for that form, you'd see the location as something
else.
*I believe* a worker thread is in deadlock (it's in a lock, but calls
another function that tries to use the same lock). If the main thread
was deadlocked, I think the debugger would stop right on that spot.
So, I assume that it is a worker thread that is deadlocked.
A thread cannot deadlock itself. That is, if a single thread has a lock,
and then attempts to get the same lock, it will succeed on the second (and
any subsequent) attempt to get the lock.
Deadlock occurs when (for example) one thread has a lock, a second thread
has a *different* lock, and each thread attempts to get the lock that the
other thread has. In that case, neither thread can get the lock it wants,
because the other thread is holding it, and neither thread will release the
lock that the other thread wants, because each thread is waiting to get the
lock that *it* wants.
Is there any way to stop the debugger into a specific thread?
Any help is greatly appreciated!!
For many months I was dismayed that the "Debug/Threads..." menu item was
removed. I had no idea where it went! I mentioned it several times in
these newsgroups, but no one had an answer. Turns out, there's a toolbar
called "Debug Location" that allows you to select the thread you want to
debug.
You'll find a bunch of threads in there that aren't ones you explicitly
made, which makes it a little trickier to find the thread you're interested
in. But you can just click through the list of threads until you find the
thread you want (hopefully you can recognize it by the code where the thread
is stopped).
Pete