Reputation: 8115
I have a running C# application that got caught into some kind of deadlock and I'd like to obtain stack traces of all running threads to analyze the problem. Unfortunately this application is a Release build and I have lost the pdb
files.
When I attach a VS2013 debugger (via remote debugging), I can see the list of threads, but not any stack traces. The stack trace window just contains "External code" for each thread.
It would be of great help to see a basic stack trace - I don't care about details like line numbers.
UPDATE I've actually observed that I have the exact same issue as long I run the Release configuration (with the remote host running the exact same build as in VS, and PDBs being available). I have only ever been able to see a stack trace in Debug builds. Could this be some other issue than a lack of PDB files?
Upvotes: 2
Views: 963
Reputation: 8115
I have found the solution, using WinDbg. In WinDbg, attach to the process, then issue the following commands.
.cordll -ve -u -l
~*e !clrstack
The former will load the extension for managed debugging (see here), and the latter will print all the backtraces (credit to this answer). I believe this just means "for all threads, do !clrstack
".
Helpful tip. The installer for Windows Debugging Tools may want to restart the system after having installed the .NET framework. You probably don't want this since it would kill the application you want to debug. Even worst, when it tells you that a restart is required, it will restart no matter if you click "OK" or "Cancel". Fortunately, one can run the installer on another machine, and copy WinDbg to the target machine, where it will work just fine without installation.
Upvotes: 2
Reputation: 58
You could use .NET Reflector to decompile the DLL's, take the resulting source and recompile it in debug so the .pdb files are included and then do your debugging.
Upvotes: 0