Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MonoDroid: Global Error Handler

Is there a way to create a global error handler for MonoDroid? My debugger is broken so I need a way to see the exception info while the application crashes.

like image 471
Jonathan Allen Avatar asked Jan 17 '23 22:01

Jonathan Allen


1 Answers

It seems that AndroidEnvironment.UnhandledExceptionRaiser is what you're looking for:

//that's a dirty-code example, do not use as-is! :)
AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) =>
                {
                    File.AppendAllText("tmp.txt", args.Exception.ToString());
                };
like image 140
Shaddix Avatar answered Feb 01 '23 17:02

Shaddix