1

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.

dattebayo
  • 2,012
  • 4
  • 30
  • 40

2 Answers2

0

This might be useful to someone finding this question http://stackdump.codeplex.com/

Gaz
  • 4,064
  • 3
  • 32
  • 34
0

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.

Kieren Johnstone
  • 41,277
  • 16
  • 94
  • 144