I have a .NET application with a button. When I click the button I want the application to print thread stack of all threads to debug console.
Is it possible to do it?
Datte.
I have a .NET application with a button. When I click the button I want the application to print thread stack of all threads to debug console.
Is it possible to do it?
Datte.
This might be useful to someone finding this question http://stackdump.codeplex.com/
You can use the StackTrace
class (System.Diagnostics
) to get a stack trace of a Thread
. You'd need to enumerate the threads, and (unfortunately) suspend them first, though.
Here's the constructor of interest: http://msdn.microsoft.com/en-us/library/t2k35tat.aspx
You may well need to create your own ThreadPool
implementation, or extend someone else's. As far as I can see/tell there's no way to enumerate them.