views:

119

answers:

4

I'm starting getting tired of this exception. Can't handle it, even so I'm using this:

AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

Still no success, Can anyone explain me, how I should handle it in a nice way. Or how to detect that it have fired this message and close the application, because I'm starting it automatically everytime it closes.

Btw, It's Console application.

alt text

+1  A: 

Have you tried placing a try{...} catch(Exception e){...} block in your main, then posting all exception data to the Windows Event Viewer? Or similarly checking the Windows Event information that is currently there.

ChrisBD
A: 

Here and here ´s are some good posts, why you get the Dialog even when you register the UnhandledExceptionEvent.

If you register to the event, it doesn´t prevent the application from beeing closed/exited. As far as i know it is by design. In the Event you have the option to log the exception and verify what went wrong in your application.

Jehof
A: 

Are you using any P/Invoke calls at all? I have had issues in the past with C interop before, where the C dll was causing an access violation error internally, which in turn crashed the C# application catastrophically - much like your screenshot above. Unfortunately it turned into a case of hunting down the entry point (P/Invoke) into the C dll by trial and error, and then fixing the C code.

If you are using P/Invoke, are all the expected dependencies on the machines and the correct versions?

chibacity
+1  A: 

IMHO best way solving this is to use remote debugging.

Lukas Šalkauskas