private static void LogUnhandledException(System.Exception exception) { //var libraryPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); //// iOS: Environment.SpecialFolder.Resources //var errorFilePath = Path.Combine(libraryPath, ErrorFileName); //File.WriteAllText(errorFilePath, errorMessage); // Log to Android Device Logging. //Android.Util.Log.Error("Crash Report", errorMessage); // just suppress any error logging exceptions CollectionCrashReport( $"Time: {DateTime.Now}\r\nError: Unhandled Exception\r\n{exception?.ToString() ?? ""}Inner Exception: \r\n{exception?.InnerException?.ToString() ?? ""}"); }
// Error/Exception Handling private static void TaskSchedulerOnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs unobservedTaskExceptionEventArgs) { try { var newExc = new System.Exception("TaskSchedulerOnUnobservedTaskException", unobservedTaskExceptionEventArgs.Exception); LogUnhandledException(newExc); } catch { // } }
private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs) { try { var newExc = new System.Exception("CurrentDomainOnUnhandledException", unhandledExceptionEventArgs.ExceptionObject as System.Exception); LogUnhandledException(newExc); } catch { // } }
public void OnFailure(System.Exception exception) { Log.Error("mode : " + v, exception.Message); }