Add a Crash Reporting Callback

You may want to make crash report information (that the Xamarin Agent collects) available to other parts of your code, such as to Google Analytics. To enable passing on summary crash information, you can set up a crash report runtime callback:

  1. To get a callback when the Xamarin Agent detects and then reports a crash, subscribe to the following event that is a part of theThe OnCrash IAgentConfiguration interface:
    event EventHandler<IEnumerable<CrashReportSummary>> OnCrash;
    The OnCrash event is raised during the next initialization of the Xamarin Agent after a crash has occurred. This event is raised on your app's UI thread, so any work should be done on a separate work thread.
  2. The Xamarin Agent sends a collection of crash report summaries instead of an individual callback in the event that there is more than one crash, producing multiple crash report summaries. Each CrashReportSummary has the following properties:
    • ExceptionName : useful for quick identification of the crash
    • ExceptionReason : useful for quick identification of the crash
    • ExceptionId : useful to look up the crash in the Controller UI
    Note: If you are sending the information to another analytics tool, such as Google Analytics, we recommend to include all three properties:
    public class CrashReportSummary
    {
    public string ExceptionId { get; }
    public string ExceptionName { get; }
    public string ExceptionReason { get; }
    }