I’m working on a .Net applications with multiple threads doing all sorts of things. When something goes wrong in production I want to be able to see which threads are running (by their managed name) and also be able to pause / kill them.
Anyway to achieve this ?
VS isn’t always available (although a good option when is), and WinDbg UI isn’t for the lite hearted.
I considered a in-program threads window, like VS has while debugging, but couldn’t find a programmatic way to do this. Process.GetThreads returns very little usable data.
There’s nothing built in to .net that will do this. If you want to programmatically iterate through your active threads, you have to register them somewhere on launch and either unregister them on completion or filter them before you act on them. We did a version of this and it requires a non-trivial amount of work.