MonoDroid:全局错误处理程序

时间:2011-12-30 19:36:51

标签: android xamarin.android

有没有办法为MonoDroid创建全局错误处理程序?我的调试器坏了所以我需要一种方法来查看应用程序崩溃时的异常信息。

3 个答案:

答案 0 :(得分:8)

似乎AndroidEnvironment.UnhandledExceptionRaiser正是您所寻找的:

//that's a dirty-code example, do not use as-is! :)
AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) =>
                {
                    File.AppendAllText("tmp.txt", args.Exception.ToString());
                };

答案 1 :(得分:1)

大多数(所有?)未处理的异常应该在Android调试日志中结束:

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

答案 2 :(得分:0)

请查看我的项目,它可以处理并提交错误信息。 https://github.com/soundnRg/Crasher

相关问题