private static MSException GenerateiOSException(Exception exception)
        {
            var msException = new MSException();

            msException.Type           = exception.GetType().FullName;
            msException.Message        = exception.Message;
            msException.StackTrace     = exception.StackTrace;
            msException.Frames         = GenerateStackFrames(exception);
            msException.WrapperSdkName = WrapperSdk.Name;

            var aggregateException = exception as AggregateException;
            var innerExceptions    = new List <MSException>();

            if (aggregateException?.InnerExceptions != null)
            {
                foreach (Exception innerException in aggregateException.InnerExceptions)
                {
                    innerExceptions.Add(GenerateiOSException(innerException));
                }
            }
            else if (exception.InnerException != null)
            {
                innerExceptions.Add(GenerateiOSException(exception.InnerException));
            }

            msException.InnerExceptions = innerExceptions.Count > 0 ? innerExceptions.ToArray() : null;

            return(msException);
        }
        private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception   systemException = e.ExceptionObject as Exception;
            MSException exception       = GenerateiOSException(systemException);

            MSWrapperExceptionManager.SetWrapperException(exception);

            byte[] exceptionBytes       = CrashesUtils.SerializeException(systemException);
            NSData wrapperExceptionData = NSData.FromArray(exceptionBytes);

            MSWrapperExceptionManager.SetWrapperExceptionData(wrapperExceptionData);
        }
Esempio n. 3
0
        static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception   systemException = e.ExceptionObject as Exception;
            MSException exception       = GenerateiOSException(systemException, true);

            byte[] exceptionBytes       = CrashesUtils.SerializeException(systemException);
            NSData wrapperExceptionData = NSData.FromArray(exceptionBytes);

            MSWrapperException wrapperException = new MSWrapperException
            {
                Exception     = exception,
                ExceptionData = wrapperExceptionData,
                ProcessId     = new NSNumber(Process.GetCurrentProcess().Id)
            };

            MSWrapperExceptionManager.SaveWrapperException(wrapperException);
        }
Esempio n. 4
0
        static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception systemException = e.ExceptionObject as Exception;

            AppCenterLog.Error(LogTag, "Unhandled Exception:", systemException);
            MSException exception = GenerateiOSException(systemException, true);

            byte[]             exceptionBytes       = CrashesUtils.SerializeException(systemException) ?? new byte[0];
            NSData             wrapperExceptionData = NSData.FromArray(exceptionBytes);
            MSWrapperException wrapperException     = new MSWrapperException
            {
                Exception     = exception,
                ExceptionData = wrapperExceptionData,
                ProcessId     = new NSNumber(Process.GetCurrentProcess().Id)
            };

            AppCenterLog.Info(LogTag, "Saving wrapper exception...");
            MSWrapperExceptionManager.SaveWrapperException(wrapperException);
            AppCenterLog.Info(LogTag, "Saved wrapper exception.");
        }