Exemplo n.º 1
0
 private static void ConvertToNsExceptionAndAbort(object e)
 {
     var nse = new NSException(".NET Exception", e.ToString(), null);
     var uncaught = NSGetUncaughtExceptionHandler();
     var dele = (ReporterDelegate)Marshal.GetDelegateForFunctionPointer(uncaught, typeof(ReporterDelegate));
     dele(nse.Handle);
 }
Exemplo n.º 2
0
        static void UncaughtExceptionHandler(IntPtr handle)
        {
            var exception = new NSException(handle);
            FA.FlurryAnalytics.LogError("3584", exception.Reason, exception);

            Console.WriteLine(@"Got an exception...{0} -- {1}", exception.Name, exception.Reason);
        }
        //        static void ConvertToNsExceptionAndAbort(object e)
        //        {
        //            var nse = new NSException(".NET Exception", e.ToString(), null);
        //            var uncaught = NSGetUncaughtExceptionHandler();
        //            var dele = (ReporterDelegate)Marshal.GetDelegateForFunctionPointer(uncaught, typeof(ReporterDelegate));
        //            dele(nse.Handle);
        //        }
        static void ConvertToNsExceptionAndAbort(object e)
        {
            var name = "Managed Xamarin.iOS .NET Exception";
            var msg = e.ToString();

            var ex = e as Exception;
            if(ex != null)
                name = string.Format("{0}: {1}", ex.GetType().FullName, ex.Message);

            name = name.Replace("%", "%%");
            msg = msg.Replace("%", "%%");
            var nse = new NSException(name, msg, null);
            var sel = new Selector("raise");
            Messaging.void_objc_msgSend(nse.Handle, sel.Handle);
        }
Exemplo n.º 4
0
        private void ConvertToNsExceptionAndAbort(object e)
        {
            Console.WriteLine("ConvertToNSExceptionAndAbort");

            var name = "Managed Xamarin.iOS .NET Exception";
            var msg  = e.ToString();

            var ex = e as Exception;

            if (ex != null)
            {
                name = ex.GetType().FullName;
                if (ex.StackTrace != null)
                {
                    msg = msg.Insert(msg.IndexOf('\n'), "Xamarin Exception Stack:");
                    Console.WriteLine("Inserted Xamarin Exception Stack Line!");
                }
                else
                {
                    Console.WriteLine("Could not find stacktrace!");
                }
            }
            else
            {
                Console.WriteLine("Could not convert to exception!");
            }
            Console.WriteLine("Name: " + name);
            Console.WriteLine("Message: " + msg);

            name = name.Replace("%", "%%");
            msg  = msg.Replace("%", "%%");
            var nse = new NSException(name, msg, null);
            var sel = new Selector("raise");

            global::Xamarin.ObjCRuntime.Messaging.void_objc_msgSend(nse.Handle, sel.Handle);
        }
Exemplo n.º 5
0
		private static void ConvertToNativeExceptionAndRaise(object e)
		{
			string name = "Managed Exception";
			string reason = e.ToString();
			Exception ex = e as Exception;

			if (ex != null)
			{
				string file = "Unknown file";
				string line = "???";

				try
				{
					if (!string.IsNullOrEmpty(reason))
					{
						string buf = reason;
						buf = buf.Replace(ex.Message, "");
						buf = buf.Replace(ex.GetType().FullName, "");
						var pos = buf.IndexOf(" in ");
						var pos2 = buf.IndexOf(".cs", pos);

						file = buf.Substring(pos + 4, pos2 + 3 - (pos + 4));

						file = Path.GetFileName(file);
						int i = pos2 + 4;
						string line2 = "";
						char tmp = reason[i];
						while ("0123456789".Contains(buf[i].ToString()) && i < buf.Length)
							line2 += buf[i++];

						line = line2;
					}
				}
				catch
				{
				}

				name = string.Format("{0}: {1} - {2} line {3}", ex.GetType().FullName, ex.Message, file, line);
			}

			name = name.Replace("%", "%%");
			reason = reason.Replace("%", "%%");

			NSException nsex = new NSException(name, reason, null);
			Selector selector = new Selector("raise");
			void_objc_msgSend(nsex.Handle, selector.Handle);
		}
Exemplo n.º 6
0
        private static void MyUncaughtExceptionHandler(IntPtr handle)
        {
            NSException exception = (NSException)Runtime.TryGetNSObject(handle);

            App.OnUnhandledException(new Exception(exception.Reason));
        }
Exemplo n.º 7
0
 public MonoTouchException(NSException exc)
     : base()
 {
     native_exc = exc;
 }
Exemplo n.º 8
0
 public MonoTouchException()
     : base()
 {
     native_exc = new NSException ("default", String.Empty, null);
 }
Exemplo n.º 9
0
 public ObjCException(NSException exc) : base()
 {
     native_exc = exc;
 }
Exemplo n.º 10
0
 public ObjCException() : base()
 {
     native_exc = new NSException("default", String.Empty, null);
 }
Exemplo n.º 11
0
        public override void ReportError(string message, Exception exception)
        {
            var nsException = new NSException(exception.Source, exception.Message, null);

            YMMYandexMetrica.ReportError(message, nsException, null);
        }
Exemplo n.º 12
0
 public ObjCException(NSException exc)
     : base()
 {
     native_exc = exc;
 }
Exemplo n.º 13
0
 public TrappedNativeException(NSException realException) :
     base($"A native exception was thrown: {realException.Description}")
 {
     NativeException = realException;
 }
Exemplo n.º 14
0
 public MonoTouchException(NSException exc) : base()
 {
     native_exc = exc;
 }
Exemplo n.º 15
0
 public ObjCException(NSException exc, string stackTrace)
 {
     native_exc  = exc;
     _stackTrace = stackTrace;
 }
 protected virtual void RaiseNativeException(Exception ex)
 {
     string name = "Managed Exception";
     string reason = "???";
 
     NSException nsex = new NSException(name, reason, null);
     Selector selector = new Selector("raise");
     void_objc_msgSend(nsex.Handle, selector.Handle);
 }
Exemplo n.º 17
0
        private static void MyUncaughtExceptionHandler(IntPtr exception)
        {
            var e = new NSException(exception);

            AppDelegate.HandleException(e.ToString());
        }
Exemplo n.º 18
0
 private static void MyUncaughtExceptionHandler(IntPtr exception)
 {
     var e = new NSException(exception);
     AppDelegate.HandleException(e.ToString());
 }