.NET application crashes without entering AppDomain.UnhandledException

I have an application that unexpectedly terminates sometimes, despite having handlers for AppDomain.CurrentDomain.UnhandledException, Application.Current.DispatcherUnhandledException, TaskScheduler.UnobservedTaskException.

This is a WPF application with lots of P / Invoke interaction code. I created a "secure network" with handlers for all the events of the "last case" (see above). But the application still does not work with the standard Windows dialog box, in which my entire handler is missing.

What could be the reason for closing the .net application and an AppDomain.CurrentDomain.UnhandledException exception?

Can such an exception be in an unmanaged thread? If so, what can I do with it?

+3
source share
1 answer

The CLR cannot magically introduce unhandled exception handling into its own pinvoked code when this code alone does not take care. In particular, any hardware exception, such as AccessViolation in a thread that the CLR is not aware of, will terminate the application without diagnostics. You will need to work with the owner or author of this code to increase the reliability and ease of maintenance of this code.

+1
source

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


All Articles