Reputation: 5203
I would like to log the stack trace of all threads in my c# application (UI). I can get the stack trace of all managed threads using WinDbg with the following commands.
.loadby sos mscorwks
~* e !clrstack
Is there any other easy methods to get the callstack of all threads in my c# application? This is because I want to get the callstack when the application is running in the customer machine and the customer is not a technical person
Please help me.
Thanks!
Upvotes: 7
Views: 2673
Reputation: 13535
Yes you can do it in a live process as well if you do deploy Windbg to the customer machine as well and then use WMemoryProfiler to execute a debugger command. It sounds strange but you can actually debug yourself with a debugger automaticaly.
See here:
private static void SelfDebug()
{
using (var debugger = new MdbEng())
{
string[] output = debugger.Execute("~*e!ClrStack");
Console.WriteLine(String.Join(Environment.NewLine, output));
}
}
Upvotes: 1
Reputation: 5651
Here's a suggestion try to grab a user dump of application using either Adplus+WinDbg or DebugDiag. And do a postmortem debugging using the userdump
Here's a good article about capturing user dumps automatically on process crashes
Good Reads Tess Fernandez's blog on msdn
http://debuggingblog.com/wp/2008/10/31/beginner-guide-to-windbg-part-1/
Upvotes: 1