9

I am developing a .Net 2.0 application in which a StackOverflowException occurs. Is there a way to print/log the stack trace before/during the application aborts? This is a long running server-side process which would be hard to execute under a debugger. I know that StackOverflowException can not be caught.

shojtsy
  • 1,710
  • 3
  • 17
  • 24
  • Does it generate a crash dump when it crashes? If so this might help http://blogs.msdn.com/tess/archive/2008/03/31/net-case-study-stackoverflow-exception-when-using-a-complex-rowfilter.aspx – Martin Smith Apr 07 '10 at 09:58
  • Also you don't say what kind of application. If it is a web application I think you need to use the IIS Debug toolkit (although I don't know about IIS7) – Martin Smith Apr 07 '10 at 10:38

1 Answers1

4

Use ADPlus (from Windows Debugging Tools) to force a dump on crash.

E.g.

adplus -hang -pn <process name> -o <dump file>
Brian Rasmussen
  • 114,645
  • 34
  • 221
  • 317
Richard
  • 106,783
  • 21
  • 203
  • 265
  • CW: Feel free to expand this with specifics (which I don't have to hand). While this doesn't cover the "before the application aborts" criterion, I don't think that is possible. – Richard Apr 07 '10 at 10:05