Quis Custodiet Ipsos Threadis

Who watches the threads? Apparently the Visual Studio 2008 debugger. Though, this should come as no surprise to anyone… except for the fact that they watch the threads even when you’re not at a break point.

The result of which is a massive lockup in your application if you try to do anything fancy like always naming your worker threads as they are spun up by the asynchronous WPF binding thread pool. I thought that it would be a good idea as it makes looking at the thread window easy to find the active worker threads you care about. But, I was wrong…

Anyway, a little sniffing around with Reflector and I ran across this little gem on the Thread class:

internal static extern void InformThreadNameChangeEx(Thread t, string name);

I wonder if the Visual Studio debugger is hooking this and bringing my application to a dead stop when this callback gets called…