Exemplo n.º 1
0
        static Crashes()
        {
            // Set up 2 different handlers, some exceptions are caught by one or the other or both (all scenarios are possible).
            // When caught on both, only the first invocation will actually be saved by the native SDK.
            // Android environment is called before app domain in case of both called, and that's what we want as
            // Android environment has a better stack trace object (no JavaProxyThrowable wrapper that cannot be serialized).
            // Client side exception object after restart not possible most of the time with AppDomain when it's JavaProxyThrowable.
            // AndroidEnvironment is also called before Java SDK exception handler (which itself not always called...).
            // App domain fallback is thus used only when both android environment and Java SDK handler cannot catch.
            // From our tests if only app domain is called, then it's not a JavaProxyThrowable, so stack trace looks fine.
            AppCenterLog.Info(LogTag, "Set up Xamarin crash handlers.");
            AndroidEnvironment.UnhandledExceptionRaiser += OnUnhandledException;
            AppDomain.CurrentDomain.UnhandledException  += OnUnhandledException;

            // Set up bridge between Java listener and .NET events/callbacks.
            AndroidCrashes.SetListener(new AndroidCrashListener());
        }
Exemplo n.º 2
0
 public PlatformCrashes()
 {
     _crashListener = new AndroidCrashListener(this);
     AndroidCrashes.SetListener(_crashListener);
 }
Exemplo n.º 3
0
 static Crashes()
 {
     AppCenterLog.Info(LogTag, "Set up Xamarin crash handler.");
     AndroidEnvironment.UnhandledExceptionRaiser += OnUnhandledException;
     AndroidCrashes.SetListener(new AndroidCrashListener());
 }