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)
            {
                AppCenterLog.Debug(Crashes.LogTag, "Cannot read throwable from java point of view, probably a .NET exception", e);
                androidThrowable = null;
            }
            AndroidDetails = new AndroidErrorDetails(androidThrowable, androidReport.ThreadName);
            iOSDetails     = null;
            byte[] exceptionBytes = AndroidExceptionDataManager.LoadWrapperExceptionData(Java.Util.UUID.FromString(Id));
            if (exceptionBytes != null)
            {
                StackTrace = CrashesUtils.DeserializeException(exceptionBytes);
            }
        }
        /// <summary>
        /// We don't assume order between java crash handler and c# crash handler.
        /// This method is called after either of those 2 events and is thus effective only the second time when we got both the c# exception and the Android error log.
        /// </summary>
        private static void JoinExceptionAndLog()
        {
            /*
             * We don't assume order between java crash handler and c# crash handler.
             * This method is called after either of those 2 events.
             * It is thus effective only the second time when we got both the .NET exception and the Android error log.
             */
            if (_errorLog != null && _exception != null)
            {
                /*
                 * Generate structured data for the C# exception and overwrite the Java exception to enhance it.
                 * Unless if we have java exception in top cause, this would make it worse.
                 * Having java exception as intermediate cause is better with .NET stack structure though.
                 */
                if (!(_exception is Java.Lang.Exception))
                {
                    _errorLog.Exception = GenerateModelException(_exception);

                    /* Tell the Android SDK to overwrite the modified error log on disk. */
                    AndroidExceptionDataManager.SaveWrapperSdkErrorLog(_errorLog);
                }

                /* Save the System.Exception to disk as a serialized object for client side inspection. */
                byte[] exceptionData = CrashesUtils.SerializeException(_exception);
                AndroidExceptionDataManager.SaveWrapperExceptionData(exceptionData, _errorLog.Id);
            }
        }
        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);
            var androidStackTrace = androidReport.StackTrace;

            AndroidDetails = new AndroidErrorDetails(androidStackTrace, androidReport.ThreadName);
            iOSDetails     = null;
            string exceptionString = AndroidExceptionDataManager.LoadWrapperExceptionData(Java.Util.UUID.FromString(Id));

            if (exceptionString != null)
            {
                StackTrace = exceptionString;
            }
        }
示例#4
0
        /// <summary>
        /// We don't assume order between java crash handler and c# crash handler.
        /// This method is called after either of those 2 events and is thus effective only the second time when we got both the c# exception and the Android error log.
        /// </summary>
        private static void JoinExceptionAndLog()
        {
            /*
             * We don't assume order between java crash handler and c# crash handler.
             * This method is called after either of those 2 events.
             * It is thus effective only the second time when we got both the c# exception and the Android error log.
             */
            if (_errorLog != null && _exception != null)
            {
                /* Generate structured data for the C# exception and overwrite the Java exception. */
                _errorLog.Exception = GenerateModelException(_exception);

                /* Tell the Android SDK to overwrite the modified error log on disk. */
                AndroidExceptionDataManager.SaveWrapperSdkErrorLog(_errorLog);

                /* Save the System.Exception to disk as a serialized object. */
                byte[] exceptionData = CrashesUtils.SerializeException(_exception);
                AndroidExceptionDataManager.SaveWrapperExceptionData(exceptionData, _errorLog.Id);
            }
        }