4

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.

Jonathan Allen
  • 68,373
  • 70
  • 259
  • 447

3 Answers3

8

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());
                };
Shaddix
  • 5,901
  • 8
  • 45
  • 86
1

Most (all?) unhandled exceptions should end up in the Android debug log:

http://docs.xamarin.com/android/advanced_topics/android_debug_log

jpobst
  • 9,982
  • 1
  • 29
  • 33
0

Please look at my project, it can handle and submit error info. https://github.com/soundnRg/Crasher

mironych
  • 2,938
  • 2
  • 28
  • 37