c# android 全局捕获未处理异常

时间:2022-06-16 02:02:31
[Application]
public class MyApp : Application
{
public MyApp(IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer) { } public override void OnCreate()
{
base.OnCreate();
AndroidEnvironment.UnhandledExceptionRaiser += MyApp_UnhandledExceptionHandler;
} void MyApp_UnhandledExceptionHandler(object sender, RaiseThrowableEventArgs e)
{ } protected override void Dispose(bool disposing)
{
AndroidEnvironment.UnhandledExceptionRaiser -= MyApp_UnhandledExceptionHandler;
base.Dispose(disposing);
}
}