The provider targets .NET Standard 2.0 and is available through NuGet packages, found here.

The currently supported platforms are Android and iOS with the following versions or newer:

  • Xamarin.Android 8.0
  • Xamarin.iOS 10.0

Make sure NuGet is installed in Visual Studio, then right-click on your project and select “Manage NuGet Packages…” Make sure you’re in the “Online” section in the left hand pane. Then, in the top right search box, search for Raygun4Xamarin.Forms and install it.


The initialisation of Raygun must occur early in the app’s initial startup phase. We recommend doing this in the constructor of your Application class. Using the static Init method will also ensure a shared RaygunClient instance is available through the static property Current.

public partial class App : Application
  public App()

    // Initialising the Raygun client 

    // Remaining application setup logic
    MainPage = new MainPage();

Each platform being targeted requires an additional configuration step using the RaygunPlatform class in the following places.

For Android:

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
  protected override void OnCreate(Bundle savedInstanceState)
    // MainActivity startup logic
    global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
    LoadApplication(new App());

    // Configure Raygun for the current platform

For iOS:

public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
  public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    // AppDelegate startup logic
    LoadApplication(new App());

    // Configure Raygun for the current platform

    return base.FinishedLaunching(app, options);

Once Crash Reporting is enabled, you are able to:

  • Automatically report unhandled exceptions
  • Manually report errors
  • Record breadcrumbs

Modify or cancel reports

The Raygun client allows you to inspect the reports before they are sent to Raygun servers. You can inspect and modify the report details or cancel the report from being sent altogether.

This is done by setting an event handler on the shared Raygun client and will be called just before a report is sent - either automatically or manually.

RaygunClient.Current.BeforeSendingCrashReportEvent += (sender, e) =>
  if (e.Report.Details.Error.ClassName == "NotImplementedException")
    e.Cancel = true;

Manually reporting errors

Sometimes you may want to send exceptions manually, such as handled exceptions from within a try/catch block.

Here’s an example of manually sending a report from a try/catch block:

catch (Exception exception)

Unique User Tracking

By default, the Raygun client will give a GUID (Globally Unique Identifier) to each user for distinguishing between them. If possible, we highly recommend providing your own unique identifiers for your users which can be done with the code below. The string you pass into the constructor can be whatever unique user id that works best for you - email address is a recommended example. Providing the first name and full name is optional.

RaygunClient.Current.User = new RaygunUserInfo("_UNIQUE_ID_")
  FirstName   = "Ronald",
  FullName    = "Ronald Raygun",
  Email       = "ronald@raygun.com",
  IsAnonymous = false

Recording breadcrumbs

Using the breadcrumbs feature, you can attach an accurate trail of the events through your system leading up to the moment a crash report was generated. You’ll gain more insight into why the application crashed when it did, making prioritization of fixes much easier. The current breadcrumbs are included with each report sent.

RaygunClient.Current.RecordBreadcrumb("Entered login screen");

Internal logging

For debugging purposes you can set the level of logging that the provider will print to your debug console. This can be helpful to determine what information is or is not being sent to the Raygun API. The logging level can be set before initialising the Raygun client.

var settings = new RaygunSettings("_API_KEY_") 
  LogLevel = LogLevel.Verbose

// Initialise a client instance.
var client = RaygunClient.Init(settings);

There are sample apps available here in the Raygun4Xamarin samples repository.