示例#1
0
        private static IEnumerator SendUnhandledExceptionReports()
        {
            yield return(null); // ensure that code is executed in main thread

            while (true)
            {
                Exception exception = null;
                lock (_unhandledExceptions)
                {
                    if (_unhandledExceptions.Count > 0)
                    {
                        exception = _unhandledExceptions.Dequeue();
                    }
                    else
                    {
                        yield break;
                    }
                }
                if (exception != null)
                {
                    var exceptionWrapper = CreateWrapperException(exception);
                    CrashesInternal.TrackException(exceptionWrapper.GetRawObject());
                }
                yield return(null); // report remaining exceptions on next frames
            }
        }
示例#2
0
 public static void OnHandleLog(string logString, string stackTrace, LogType type)
 {
     if (LogType.Assert == type || LogType.Exception == type || LogType.Error == type)
     {
         var exception = CreateWrapperException(logString, stackTrace, type);
         CrashesInternal.TrackException(exception.GetRawObject());
     }
 }
示例#3
0
 public static void TrackError(Exception exception, IDictionary <string, string> properties = null, params ErrorAttachmentLog[] attachments)
 {
     if (exception != null)
     {
         var exceptionWrapper = CreateWrapperException(exception);
         CrashesInternal.TrackException(exceptionWrapper.GetRawObject(), properties, attachments);
     }
 }
示例#4
0
        private static void SendErrorAttachments(string errorReportId)
        {
            // Send attachments for error report.
            var errorReport = CrashesInternal.BuildHandledErrorReport(errorReportId);

            errorReport.IsCrash = false;
            var attachments = CrashesDelegate.GetErrorAttachmentsHandler == null ? null : CrashesDelegate.GetErrorAttachmentsHandler(errorReport);

            CrashesInternal.SendErrorAttachments(errorReportId, attachments);
        }
示例#5
0
        private static void TrackErrorWithAttachments(Exception exception)
        {
            var exceptionWrapper = CreateWrapperException(exception);
            var errorId          = CrashesInternal.TrackException(exceptionWrapper.GetRawObject(), null, null);

            // If the main thread is not crashed, attachments should be sent.
            if (_enableErrorAttachmentsCallbacks)
            {
                SendErrorAttachments(errorId);
            }
        }
示例#6
0
 public static void OnHandleLog(string logString, string stackTrace, LogType type)
 {
     if (LogType.Assert == type || LogType.Exception == type || LogType.Error == type)
     {
         var exception     = CreateWrapperException(logString, stackTrace, type);
         var errorReportId = CrashesInternal.TrackException(exception.GetRawObject(), null, null);
         if (_enableErrorAttachmentsCallbacks)
         {
             SendErrorAttachments(errorReportId);
         }
     }
 }
示例#7
0
 public static void TrackError(Exception exception, IDictionary <string, string> properties = null)
 {
     if (exception != null)
     {
         var exceptionWrapper = CreateWrapperException(exception);
         if (properties == null || properties.Count == 0)
         {
             CrashesInternal.TrackException(exceptionWrapper.GetRawObject());
         }
         else
         {
             CrashesInternal.TrackException(exceptionWrapper.GetRawObject(), properties);
         }
     }
 }
示例#8
0
        public static void OnHandleUnresolvedException(object sender, UnhandledExceptionEventArgs args)
        {
            if (args == null || args.ExceptionObject == null)
            {
                return;
            }
            var exception = args.ExceptionObject as Exception;

            if (exception != null)
            {
                Debug.Log("Unhandled exception: " + exception.ToString());
#if UNITY_ANDROID
                lock (_unhandledExceptions)
                {
                    _unhandledExceptions.Enqueue(exception);
                }
                UnityCoroutineHelper.StartCoroutine(SendUnhandledExceptionReports);
#else
                var exceptionWrapper = CreateWrapperException(exception);
                CrashesInternal.TrackException(exceptionWrapper.GetRawObject());
#endif
            }
        }
示例#9
0
 public static void AddNativeType(List <RawType> nativeTypes)
 {
     CrashesInternal.AddNativeType(nativeTypes);
 }
示例#10
0
 public static void StartCrashes()
 {
     CrashesInternal.StartCrashes();
 }
示例#11
0
 public static void NotifyUserConfirmation(ConfirmationResult answer)
 {
     CrashesInternal.NotifyWithUserConfirmation(answer);
 }
示例#12
0
 public static AppCenterTask <string> GetMinidumpDirectoryAsync()
 {
     return(CrashesInternal.GetMinidumpDirectoryAsync());
 }
示例#13
0
 public static AppCenterTask <bool> HasCrashedInLastSessionAsync()
 {
     return(CrashesInternal.HasCrashedInLastSessionAsync());
 }
示例#14
0
 public static void GenerateTestCrash()
 {
     CrashesInternal.GenerateTestCrash();
 }
示例#15
0
 public static AppCenterTask SetEnabledAsync(bool enabled)
 {
     return(CrashesInternal.SetEnabledAsync(enabled));
 }
示例#16
0
 public static AppCenterTask <bool> IsEnabledAsync()
 {
     return(CrashesInternal.IsEnabledAsync());
 }
示例#17
0
 public static void DisableMachExceptionHandler()
 {
     CrashesInternal.DisableMachExceptionHandler();
 }
示例#18
0
 public static AppCenterTask <ErrorReport> GetLastSessionCrashReportAsync()
 {
     return(CrashesInternal.GetLastSessionCrashReportAsync());
 }
示例#19
0
 public static AppCenterTask <bool> HasReceivedMemoryWarningInLastSessionAsync()
 {
     return(CrashesInternal.HasReceivedMemoryWarningInLastSessionAsync());
 }
示例#20
0
 public static ErrorReport LastSessionCrashReport()
 {
     return(CrashesInternal.LastSessionCrashReport());
 }