How can I enumerate all managed threads in C#?
Solution 1:
Debuggers are often able to do things "normal" code can't. You'd probably find that you can do this if you use the profiling/debugging API, but I don't believe you can do it from "normal" .NET code.
Solution 2:
This sounds like a duplicate of "How to enumerate threads in .NET using the Name property?" - If so, the short answer is "keep track of your own threads yourself" - i.e. in a List<Thread>
or similar.
Solution 3:
Take a look at Managed Stack Explorer:
MSE works by quickly attaching to a process when a stack trace is requested and the detaching the second the stack trace has been retrieved. This way the interference in the normal operation of the process is minimized.
Unfortunately, this means it has to done by an external process.
A similar tool is StackDump, which uses MDbg to generate the dump.