I have a handler for AppDomain.CurrentDomain.UnhandledException that uses Async calls to write an error log file. Unfortunately, it returns to the source of the exception (which then shows the default error message popup) before the Async functions have completed. How can I prevent this without blocking? In other words keep the message pump active, but prevent the handler from returning? My aim is to log the error and then exit the application without any default messages.
internal async void CLRErrorHandler(object sender, UnhandledExceptionEventArgs e)
{
await HandleError(e.ExceptionObject); // this uses async calls to write the error report.
}