views:

69

answers:

1

Hi, I am trying to enable JIT debugging for my winform application, I want to use Dr Watson to dump the stack trace, but when the exception is happening on my App I get a .NET dialog box (Continue or Quit), the details in this box say that I have to change some values in the machine.config or in the app.config of this application

will i tried to add this:

<configuration>
  <system.windows.forms jitDebugging="true" />
</configuration>

to my App.config

But the same box is still shown every time an exception happen, I tried with debug and release versions (and with debug version with pdb file)

How I can get rid of this dialog and enable JIT? I think when I do that I will be able to use Dr Watson (by the way I already ran Drwtsn32.exe -i, and there is no VS installed on that machine)

+1  A: 

Add this line to your Main() method, before the Application.Run() call:

  Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);

This disables the ThreadExceptionDialog and trips the AppDomain.UnhandledException event. I doubt you'll get a stack trace out of Watson. You'd better create your own by writing a handler for AppDomain.UnhandledException.

Hans Passant
Great, that worked and you was right Dr Watson gave nothing (I wonder why). Thanks for the help
TB