예제 #1
0
        internal ErrorReport(MSErrorReport msReport)
        {
            // If Id is not null we have loaded the report from the cache
            if (Id != null)
            {
                return;
            }

            Id           = msReport.IncidentIdentifier;
            AppStartTime = NSDateToDateTimeOffset(msReport.AppStartTime);
            AppErrorTime = NSDateToDateTimeOffset(msReport.AppErrorTime);
            Device       = msReport.Device == null ? null : new Device(msReport.Device);

            AndroidDetails = null;

            iOSDetails = new iOSErrorDetails(msReport.ReporterKey,
                                             msReport.Signal,
                                             msReport.ExceptionName,
                                             msReport.ExceptionReason,
                                             (uint)msReport.AppProcessIdentifier);

            MSWrapperException wrapperException = MSWrapperExceptionManager.LoadWrapperExceptionWithUUID(msReport.IncidentIdentifier);

            if (wrapperException != null && wrapperException.ExceptionData != null)
            {
                Exception = CrashesUtils.DeserializeException(wrapperException.ExceptionData.ToArray());
            }
        }
        internal ErrorReport(AndroidErrorReport androidReport)
        {
            Id           = androidReport.Id;
            AppStartTime = DateTimeOffset.FromUnixTimeMilliseconds(androidReport.AppStartTime.Time);
            AppErrorTime = DateTimeOffset.FromUnixTimeMilliseconds(androidReport.AppErrorTime.Time);
            Device       = androidReport.Device == null ? null : new Device(androidReport.Device);

            object androidThrowable;

            try
            {
                androidThrowable = androidReport.Throwable;
            }
            catch (Exception e)
            {
                MobileCenterLog.Debug(Crashes.LogTag, "Cannot read throwable from java point of view, probably a .NET exception", e);
                androidThrowable = null;
                byte[] exceptionBytes = AndroidExceptionDataManager.LoadWrapperExceptionData(Java.Util.UUID.FromString(Id));
                if (exceptionBytes != null)
                {
                    Exception = CrashesUtils.DeserializeException(exceptionBytes);
                }
            }

            AndroidDetails = new AndroidErrorDetails(androidThrowable, androidReport.ThreadName);
            iOSDetails     = null;
        }