Raygun for Xamarin.iOS: Support for NSExceptions

Jason FauchelleProvider UpdatesLeave a Comment

Raygun supports a wide range of languages and platforms, one of which is Xamarin for iOS that allows developers to build iOS applications using .NET. By integrating the Raygun4Net provider into your Xamarin.iOS applications, exception details are sent to your Raygun dashboard if your application crashes while a customer is using it. Most of the time these will be .NET exceptions, but in some situations an exception may occur in the native Objective-C core of the application resulting in an NSException being thrown. Xamarin wraps these up in a MonoTouchException which Raygun will happily catch and send to your dashboard. This is great, but the stack trace from this type of exception is nothing to look at:

All you get is a message saying that the exception started from Main.cs, not where the exception actually occurred. Not the worlds most helpful stack trace!

We have recently updated the Raygun Xamarin.iOS support for this scenario to send the native Objective-C stack trace instead which can provide much more insight as to what the problem is.

Improved grouping

The first line displayed in the previous code block is the exception message. Some of the error grouping takes into account the message which can result in a group being made too frequently for what is essentially the same exception. For NSException messages such as the one displayed above (which I’ve displayed again below), you’ll see there is a memory address displayed at the end.

This address is always different, even if 2 exceptions occurred in the same point of code. We have of course taken this into consideration with the Raygun grouping logic. For NSException messages, the memory address will be ignored so that messages that come from the same exception will be grouped together in your dashboard. This is so we provide first class app support for NSExceptions.

These improvements to the Xamarin.iOS support are available right now! Make sure to integrate the latest provider into your application so that you can log better stack traces for these types of exceptions. Look for version 1.0.12 or higher on GitHub, NuGet or the Xamarin Component Store.

Happy blasting!

Next level software intelligence across your entire stack.

Leave a Reply

Your email address will not be published. Required fields are marked *