Visual Studio App Center Analytics is the next generation of Xamarin Insights! Read the blog post.

Dealing with Startup Crashes

PDF for offline use
Related Links:

Let us know how you feel about this

Translation Quality


0/250

Crashes on startup can be complicated to deal with. For example, you may find that your application crashes at startup in a way that does not give Insights enough time to transmit the crash report. Insights provides a specific event handler to deal with this problem, which should be placed before the Initialize call:

Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
{
    if (isStartupCrash) {
        Insights.PurgePendingCrashReports().Wait();
    }
};
Insights.Initialize("Your API Key");

This API allows you to get a notification when Insights detects a pending crash report. Calling Insights.PurgePendingCrashReports() allows you to block while those crash reports are sent out.

This can delay your app startup time, and is therefore an optional API.

The isStartupCrash value in your event handler will inform you whether the crash occurred within 5 seconds of app startup, which generally indicates that the app crashed during startup.

Short Lived Applications

In particular, if you have short lived application, such as a command line application, you should call Insights.PurgeAllPendingData().Wait() to ensure that Insights can send data before your app closes.

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.