Insights is joining HockeyApp! Read the blog post. FAQ

Allowing an Exception and Reporting Additional Information

PDF for offline use
Related Links:

Let us know how you feel about this


0/250

If we wish to allow a given exception to still be thrown but still want to add additional information to the report, we can use the Exception.Data property.

The code snippet below shows an example of how to do this:

try {
    ExceptionThrowingFunction();
}
catch (Exception exception) {
    exception.Data["AccountType"] = "standard";
    throw;
}

Here we've used a key/value pair to add the additional information and used the throw method to allow the exception to continue.

Disabling Uncaught Exception Reporting

There might be situations where we do not wish to send uncaught exceptions (outside of a try/catch block) to the Xamarin Insights service. In those situations, add the following line to your application:

Insights.DisableExceptionCatching = true;

With this property set, no exception that occurs outside of a try/catch block will be logged.

If you have disabled automatic exception handling, you can add the following line to your own unhandled exception handler to send the exception information on to Xamarin Insights:

Xamarin.Insights.Save();

Note: The Save() method is not intended for regular Insights use. Use it only in the situation where you have disabled automatic exception handling and still want to send unhandled exceptions to Insights after you have done your own processing.

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.