1

I have a global exception handler that was working very good in previous iOS versions. but I need to update my application and make compatible for iOS 10. Well I am not sure if something has been changed by Apple.

This is my global event handler

            AppDomain.CurrentDomain.UnhandledException += (sender, args) => InvokeOnMainThread (new Action (() => {


                CommonTableViewController.HideLoadingScreen2 ();
                HideLoadingScreen();

                var exception = ((Exception)args.ExceptionObject);
                string message="";
                if(exception.InnerException!=null)
                    message = exception.Message + Environment.NewLine+  exception.InnerException.Message;                   
                else 
                    message = exception.Message;
                AlertUtil.CreateMessage ("General_Error_Message".t (), message);                

            })); 

I assign this event in my login controlview. And then if an exception that i do not catch, occured, I got this exception in here UIApplication.Main(args, null, "AppDelegate");

and then the app crashes.. I dont know why this exception handler does not catch this exception anymore.

I tried to create also one exception handler in the related controlview but this time,when i loaded the controlview, then application crashes.

As I see, one time must be enough. And I dont want to catch all exceptions. Because i already built my logic like that.

So, my question is that is there any difference for UnhandledException thing? My approach seems not so valid anymore. Because when i also tried to do same thing in the login viewcontroller, i was faced to the same problem. But I put a try-cath. So now i dont want to put try-catches everywhere.

ertan2002
  • 1,458
  • 1
  • 32
  • 68
  • 1
    I found this, but have yet to test it: https://stackoverflow.com/questions/39503390/global-exception-handling-in-xamarin-cross-platform – Dylan Berry Oct 18 '17 at 15:10

0 Answers0