private void HandleAndroidException(object sender, RaiseThrowableEventArgs e)
 {
     e.Handled = true;
     Log.Debug("MainApplication", "exception-message:" + e.Exception.Message);
     Log.Debug("MainApplication", "exception-stack:" + e.Exception.StackTrace);
     Log.Debug("MainApplication", "exception-source:" + e.Exception.Source);
 }
Beispiel #2
0
        async void AndroidEnvironment_UnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs ex)
        {
            await Task.Run(() =>
            {
                Looper.Prepare();
                Toast.MakeText(this, Resources.GetString(Resource.String.search), ToastLength.Long).Show();
                Looper.Loop();
            });

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("生产厂商\n");
            sb.Append(Build.Manufacturer).Append("\n\n");
            sb.Append("手机型号\n");
            sb.Append(Build.Model).Append("\n\n");
            sb.Append("系统版本\n");
            sb.Append(Build.VERSION.Release).Append("\n\n");
            sb.Append("异常时间\n");
            sb.Append(DateTime.Now.ToString()).Append("\n\n");
            sb.Append("异常信息\n");
            sb.Append(ex.Exception).Append("\n");
            sb.Append(ex.Exception.Message).Append("\n");
            sb.Append(ex.Exception.StackTrace).Append("\n\n");
            MobclickAgent.ReportError(this, sb.ToString());

            System.Threading.Thread.Sleep(2000);
            Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
            Java.Lang.JavaSystem.Exit(1);
        }
Beispiel #3
0
        void MyApp_UnhandledExceptionHandler(object sender, RaiseThrowableEventArgs e)
        {
            var packageInfo = PackageManager.GetPackageInfo(PackageName, PackageInfoFlags.MetaData);

            // Do your error handling here.

            if (api == null)
            {
                api = ElmahioAPI.Create("API_KEY");
            }

            var exception     = e.Exception;
            var baseException = exception?.GetBaseException();

            api.Messages.Create("LOG_ID", new CreateMessage
            {
                Data        = exception?.ToDataList(),
                DateTime    = DateTime.UtcNow,
                Detail      = exception?.ToString(),
                Severity    = "Error",
                Source      = baseException?.Source,
                Title       = baseException?.Message ?? "Unhandled Xamarin exception",
                Type        = baseException?.GetType().FullName,
                Version     = packageInfo.VersionName,
                Application = packageInfo.PackageName,
            });
        }
Beispiel #4
0
        private void OnUnhandledAndroidException(object sender, RaiseThrowableEventArgs e)
        {
            if (e?.Exception != null)
            {
                string correlationId = GetCorrelationId();
                if (!string.IsNullOrEmpty(correlationId))
                {
                    LogUtils.LogMessage(
                        LogSeverity.INFO,
                        "The user has experienced native Android crash",
                        null,
                        correlationId);
                }

                string message = $"{nameof(MainApplication)}.{nameof(OnUnhandledAndroidException)}: "
                                 + (!e.Handled
                                     ? "Native unhandled crash"
                                     : "Native unhandled exception - not crashing");

                LogSeverity logLevel = e.Handled
                    ? LogSeverity.WARNING
                    : LogSeverity.ERROR;

                LogUtils.LogException(logLevel, e.Exception, message);
            }
        }
Beispiel #5
0
 void MyApp_UnhandledExceptionHandler(object sender, RaiseThrowableEventArgs e)
 {
     Kp2aLog.LogUnexpectedError(e.Exception);
     Xamarin.Insights.Save();
     // Do your error handling here.
     //throw e.Exception;
 }
Beispiel #6
0
 private void AndroidEnvironmentOnUnhandledException(object sender, RaiseThrowableEventArgs e)
 {
     if (sender != null)
     {
         return;
     }
 }
Beispiel #7
0
        private void AndroidEnvironment_UnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs e)
        {
            var message = Utilities.AppendExceptionToMessage("", e.Exception);

            //Utilities.SaveCrashFile(message, true);
            Utilities.SendCrashEmail(message, false);
        }
Beispiel #8
0
        private void HandleAndroidException(object sender, RaiseThrowableEventArgs e)
        {
            e.Handled = true;
            var exception = new Exception("CurrentDomainOnUnhandledException", e.Exception);

            LogUnhandledException(exception);
        }
Beispiel #9
0
        protected static void HandleUnhandledException(object sender, RaiseThrowableEventArgs args)
        {
            Exception e  = (Exception)args.Exception;
            var       id = Bugfender.SendIssue(e.Message + " (managed code exception)", "```\n" + e + "\n```");

            Console.WriteLine("Sending managed code exception: {0} {1}", id, e);
        }
Beispiel #10
0
        private void HandleUnhandledException(object sender, RaiseThrowableEventArgs args)
        {
            var mvxLogProvider = Mvx.IoCProvider.Resolve <IMvxLogProvider>();
            var mvxLog         = mvxLogProvider.GetLogFor(GetType());

            mvxLog.TraceException(args.Exception.Message, args.Exception);
        }
        private void UnhandledExceptionHandler(object sender, RaiseThrowableEventArgs e)
        {
            Mvx.IoCProvider.Resolve <ILoggingService>().Fatal(e.Exception, "Fatal error occured");
            e.Handled = false;

            throw e.Exception;
        }
Beispiel #12
0
        static void HandleAndroidException(object sender, RaiseThrowableEventArgs e)
        {
            e.Handled = true;
            var exception = new Exception(nameof(CurrentDomainOnUnhandledException), e.Exception);

            LogUnhandledException(exception);
        }
Beispiel #13
0
 private void AndroidEnvironment_UnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs e)
 {
     Log.Error("MP", e.Exception.StackTrace.ToString());
     Debugger.Break();
     e.Handled = true;
     throw e.Exception;
 }
Beispiel #14
0
        protected void UnhandledExceptionHandler(object sender, RaiseThrowableEventArgs args)
        {
            // log won't be available, because dalvik is destroying the process
            // Log.Debug (logTag, "MyHandler caught : " + e.Message);
            // instead, your err handling code should be run:

            _log.CrashDump("UNHANDLED 2", args.Exception);
        }
Beispiel #15
0
 void HandleAndroidException(object sender, RaiseThrowableEventArgs e)
 {
     if (e.Exception.GetType() == typeof(System.Net.WebException))
     {
         ExceptionHelper.NoConnection();
         e.Handled = true;
     }
 }
        private void OnAndroidEnvironmentUnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs unhandledExceptionEventArgs)
        {
            var newExc = new System.Exception("OnAndroidEnvironmentUnhandledExceptionRaiser", unhandledExceptionEventArgs.Exception);

            ExceptionErrorLogger.writeFileOnInternalStorage(newExc.ToString());

            Console.WriteLine(newExc);
        }
Beispiel #17
0
        private static void LogUnhandledException(RaiseThrowableEventArgs e)
        {
            string name    = e.Exception.GetType().FullName;
            string message = e.Exception.Message;
            string stack   = StackTrace(e.Exception);

            Com.Crittercism.App.Crittercism._logCrashException(name, message, stack);
        }
Beispiel #18
0
 private void AndroidEnvironmentOnUnhandledException(object sender, RaiseThrowableEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine($"Unhandled Exception: {e.Exception.Message}");
     if (Debugger.IsAttached)
     {
         Debugger.Break();
     }
 }
Beispiel #19
0
        private void OnAndroidEnvironmentUnhandledExceptionRaiser(object s, RaiseThrowableEventArgs e)
        {
            var ex = e.Exception as Exception;

            Console.WriteLine("Domain Exception from  {0}: {1}", s.GetType(), ex != null ? ex.ToString() : e.ToString());

            e.Handled = true;
        }
Beispiel #20
0
 private void AndroidEnvironment_UnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs e)
 {
     Log.Error("MP", e.Exception.StackTrace.ToString());
     Debugger.Break();
     e.Handled = true;
     DoToastMessage("ERROR " + e.Exception.Message, ToastLength.Long);
     throw e.Exception;
 }
Beispiel #21
0
 private void AndroidEnvironment_UnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs e)
 {
     //Emulate sending our exception to remote statistics server.
     for (int i = 0; i < 100000; i++)
     {
         //Console.Write(i + " ");
     }
     Console.WriteLine("AndroidEnvironment_UnhandledExceptionRaiser: Exception handling completed.");
 }
Beispiel #22
0
        public void OnUnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs e)
        {
            Exception managedException = (Exception)e.Exception;

            if (managedException != null)
            {
                AI.XamarinSDK.Abstractions.TelemetryManager.TrackManagedException(managedException, false);
            }
        }
Beispiel #23
0
        void AndroidEnvironment_UnhandledException(object sender, RaiseThrowableEventArgs args)
        {
            lock (_crashesLock)
            {
                _unhandledExceptions.Add(new ExceptionData(_appVersion, DateTime.UtcNow, args.Exception));
            }

            Serialize();
        }
Beispiel #24
0
        void HandleAndroidException(object sender, RaiseThrowableEventArgs e)
        {
            string s = e.Exception.StackTrace;

            //Device.BeginInvokeOnMainThread(() => App.UserDialogService.HideLoading());

            e.Handled = true;
            System.Console.Write("YOU'VE JUST BEEN HANDLED!");
        }
Beispiel #25
0
        static void handleAndroidException(object sender, RaiseThrowableEventArgs e)
        {
            Log.Error("INTERNAL DEBUG", "MainActivity::Unhandled Exception");
            e.Handled = true;

            var failureInfo = TraceHelper.ExceptionToString(e.Exception);

            Console.WriteLine("MainActivity::HandleAndroidException(): " + failureInfo);
        }
        void HandleAndroidException(object sender, RaiseThrowableEventArgs e)
        {
            Log.Error("NotificationActivity Activity: INTERNAL DEBUG", "PLEASE HANDLE MY EXCEPTION!");
            e.Handled = true;

            var failureInfo = TraceHelper.ExceptionToString(e.Exception);

            Console.WriteLine("NotificationActivity::HandleAndroidException(): " + failureInfo);
        }
Beispiel #27
0
        private void AndroidEnvironmentOnUnhandledException(object sender, RaiseThrowableEventArgs e)
        {
            e.Handled = true;

            System.Diagnostics.Debug.WriteLine("Catch in AndroidEnvironmentOnUnhandledException:   " + e.Exception.Message + e.Exception.StackTrace);


            QueueMessageBoxNotification.Instance.ActionMessageBox(null, null, Res.Instance.GetString("ErrorBig"), e.Exception.Message + e.Exception.StackTrace, MessageBoxMode.Dialog, MessageBoxImageMode.Error, MessageBoxButtonMode.OK, null, null);
        }
Beispiel #28
0
        private void HandleAndroidException(object sender, RaiseThrowableEventArgs e)
        {
            Intent intent = new Intent(this, typeof(CrashActivity));

            intent.PutExtra("Error_Text", e.Exception.Message);
            intent.SetFlags(ActivityFlags.NewTask);
            this.StartActivity(intent);
            Java.Lang.JavaSystem.Exit(0); // Close this app process
        }
Beispiel #29
0
        private void AndroidEnvironment_UnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs e)
        {
            e.Handled = true;
            var alertDialog = new AlertDialog.Builder(this);

            alertDialog.SetTitle("Exception");
            alertDialog.SetMessage(e.Exception.Message + "____" + e.Exception.ToString());
            alertDialog.SetNeutralButton("Ok", (s, ee) => { });
            alertDialog.Show();
        }
Beispiel #30
0
        private void AndroidEnvironment_UnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs e)
        {
            string path     = Android.OS.Environment.ExternalStorageDirectory.Path;
            string fileName = "/error.txt";

            using (var streamWriter = new StreamWriter(path + fileName, false))
            {
                streamWriter.WriteLine(e.Exception.InnerException + "," + e.Exception.Message + "," + e.Exception.StackTrace + "," + e.Exception.Source + "," + e.Exception.Data);
            }
        }