Forum Xamarin.Android

Unhandled Exception Problem

I believe their may be a bug with how Mono for Android is handling uncaught exceptions. I was able to successfully use UnhandledExceptionRaiser to add some error logging to my application, but I noticed that the application then crashes differently on 2.3 and 4.2 devices. I added throw new Exception("TEST EXCEPTION!"); to one of my activity's onCreate() methods to test the error handling. On 2.3, the device just loads the home screen. On 4.2, the device sits on the activity that threw the exception, but the screen is mostly frozen, and the app needs to be manually killed. If I change the test to use Android.Runtime.AndroidEnvironment.RaiseThrowable(new Java.Lang.Throwable("TEST")); the app crashes and gives me the android dialog explaining that the app crashed and needed to close. I believe that dialog is the desired functionality, but for some reason Mono for Android isn't passing the error down to the Java environment properly.


  • JonathanPryorJonathanPryor USXamarin Team Xamurai

    This is probably bug 7634.

  • MWeinandMWeinand USMember

    That may be it. Mine is more the one way Managed -> Java exception handling, but it may be broken on that first part. Anyone have a workaround, or am I stuck waiting for Xamarin to fix it?

Sign In or Register to comment.