How to catch this type of exceptions?

I'm starting to get tired of this exception. Can't handle it even if I use this:

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

Still unsuccessful. Can someone explain to me how I should deal with this good way. Or how to determine that this message worked, and close the application, because I start it automatically every time it closes.

By the way, this is a console application.

alt text

+4
source share
4 answers

The best way to solve IMHO is to use remote debugging .

+1
source

Have you tried placing the try{...} catch(Exception e){...} in your main article and then posting all the exception data to the Windows Event Viewer? Or similarly, check for Windows event information that currently exists.

+1
source

Here and here there are some good messages why you get a dialog, even when you are registering a UnhandledExceptionEvent.

If you register for the event, this will not prevent the application from closing / exiting. As far as I know, this is by design. In the event, you have the opportunity to register an exception and check what went wrong in your application.

0
source

Do you use any P / Invoke calls? I used to have problems with C interop, where the C dll caused an access violation error inside, which in turn catastrophically damaged the C # application - like your screenshot above. Unfortunately, it turned into a case of searching at the entry point (P / Invoke) in the C dll by trial and error, and then with fixing the C code.

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

0
source

Source: https://habr.com/ru/post/1310077/


All Articles