This question is a bit old, but I just found a nice way of getting the stack trace of my application just before overflowing and I would like share it with other googlers out there:
-
When your ASP.NET app crashes, a set of debugging files are dumped in a “crash folder” inside this main folder:
C:\ProgramData\Microsoft\Windows\WER\ReportQueue
-
These files can be analysed using WinDbg, which you can download from one of the links below:
- Windows WinDbg x86 installer
- Windows WinDbg x64 installer
-
After installing it in the same machine where your app crashed, click File > Open Crash Dump and select the largest .tmp file in your “crash folder” (mine had 180 MB). Something like:
AppCrash_w3wp.exe_3d6ded0d29abf2144c567e08f6b23316ff3a7_cab_849897b9\WER688D.tmp
-
Then, run the following commands in the command window that just opened:
.loadby sos clr !clrstack
-
Finally, the generated output will contain your app stack trace just before overflowing, and you can easily track down what caused the overflow. In my case it was a buggy logging method:
000000dea63aed30 000007fd88dea0c3 Library.Logging.ExceptionInfo..ctor(System.Exception) 000000dea63aedd0 000007fd88dea0c3 Library.Logging.ExceptionInfo..ctor(System.Exception) 000000dea63aee70 000007fd88dea0c3 Library.Logging.ExceptionInfo..ctor(System.Exception) 000000dea63aef10 000007fd88dea0c3 Library.Logging.ExceptionInfo..ctor(System.Exception) 000000dea63aefb0 000007fd88de9d00 Library.Logging.RepositoryLogger.Error(System.Object, System.Exception) 000000dea63af040 000007fd88de9ba0 Library.WebServices.ErrorLogger.ProvideFault(System.Exception, System.ServiceModel.Channels.MessageVersion, System.ServiceModel.Channels.Message ByRef)
Thanks to Paul White and his blog post: Debugging Faulting Application w3wp.exe Crashes