MonoDroid:全局错误处理程序

Jon*_*len 4 android xamarin.android

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

Sha*_*dix 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());
                };
Run Code Online (Sandbox Code Playgroud)