我想记录未处理的异常,但我看到有关这是否以及如何可能的相互矛盾的信息.
我知道Xamarin引发了一个AndroidEnvironment.UnhandledExceptionRaiser或者AppDomain.CurrentDomain.UnhandledException事件并且我可以订阅这个事件,但我的印象是Android正在杀死我的进程并且我无法访问Android.Utils.Log或文件系统.
如果您看一下Xamarin的AdvancedAppLifecycleDemos/HandlingCrashes/App.cs,那么您就无法记录此异常.
/// <summary>
/// When app-wide unhandled exceptions are hit, this will handle them. Be aware however, that typically
/// android will be destroying the process, so there's not a lot you can do on the android side of things,
/// but your xamarin code should still be able to work. so if you have a custom err logging manager or
/// something, you can call that here. You _won't_ be able …Run Code Online (Sandbox Code Playgroud)