Print thread stack of all threads of a process
问题 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. 回答1: 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