MonoDroid: Global Error Handler

2020-02-14 04:21发布

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.

3条回答
祖国的老花朵
2楼-- · 2020-02-14 04:48

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

查看更多
趁早两清
3楼-- · 2020-02-14 04:52

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

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

查看更多
Emotional °昔
4楼-- · 2020-02-14 05:00

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());
                };
查看更多
登录 后发表回答