Replies: 2 comments
-
You can implement Sentry in your app. There you get some info about unhandled exceptions. But often this error message is also not very helpful. |
Beta Was this translation helpful? Give feedback.
-
For unhandled exceptions, I've written them to a log file the moment they occur: AppDomain.CurrentDomain.UnhandledException += (s, e) => {
if (e as Exception _e) {
// write _e.Message and _e.StackTrace to log file
}
}; Then, let the app crash. Then, on the next run of the app, I check the log file and, if something is interesting in it, I show the contents to the user and give them the option to email it with: await Share.RequestAsync(new ShareFileRequest {
Title = "Crash report",
File = new ShareFile( /* path to log file */ )
} ); [EDIT] After rereading the original question, it feels like some corruption has occurred but it is not being realized until the app is doing cleanup on shutdown. Most likely a late invocation of the garbage collector. To spot corruption closer to where it occurs, I recommend filling your code with GC.Collect in the hope of catching the corruption earlier and obtain a more useful call stack. |
Beta Was this translation helpful? Give feedback.
-
Any ideas on how to track down the source of unhandled exception errors? I get this error message when I stop the Maui app, not when it's running
Windows event log shows the error is in the Microsoft.UI.Input.dll module.
Beta Was this translation helpful? Give feedback.
All reactions