Xamarin android - Integration with crittercism for unhandled exceptions not working

535 Views Asked by At

I've created a bindings project, hooked everything up in my onCreate etc. Everything works except for unhandled exceptions. Let me elaborate on "Everything works" - I can see via crittercism's live stats page that there is indeed an app load, I can also send up "ManagedExceptions" using the "LogHandledException" interface.

I have implemented the ICritterCallback interface and the "CrashedOnLastLoad" boolean is always false. This is wierd cos I can see the app crashes.

I have used these 3 ways to try and get my logs sent to Crittercism. (All 3 crash the app)

Java exception

throw new Java.Lang.IllegalArgumentException("This is a test for critter");

Background exception

.Click += delegate { ThreadPool.QueueUserWorkItem(o => { throw new Exception("Crashed Background thread."); } ); };

Simple .net exception

throw new Exception("Crashed UI thread.");

None of the above are registering as crashes on the next load... weird right?

Maybe the .net runtime is swallowing all the unhandled exceptions then calling exit gracefully on dalvic's runtime... is this possible..?

As a hack for now im implementing the exception handlers for android as per this blog post then calling Crittercism.LogHandledException(Throwable.FromException(e.Exception)); from inside both the events.

It works, but im using Crittercism's handled exceptions for unhandled exceptions.. So when I want to send up real "HandledExceptions" they will be lost in the mess.

So is there any way to send an unhandled exception to Crittercism??
Or is there a way to simulate a crash on android from .net that will send it to Crittercism??

Any help would be much appreciated!

Cheers,
Sam

1

There are 1 best solutions below

0
On

Co-founder of Crittercism here. We just released an official plugin for Xamarin which should automatically log javascript exceptions (and any other crashes) as unhandled exceptions so you won't run into this problem anymore. You can download the latest version from the Xamarin asset store here:

http://components.xamarin.com/view/crittercism