The SDK is compatible with the following versions or higher:
- Xamarin.Android 9.0
- Xamarin.iOS 10.14
- Universal Windows Platform 10.0.16299
- Tizen 4.0
Install the NuGet package:
# For Xamarin.Forms
Install-Package Sentry.Xamarin.Forms -Version 2.0.0
# If you are not using Xamarin.Forms, but only Xamarin:
Install-Package Sentry.Xamarin -Version 2.0.0
After you’ve completed setting up a project in Sentry, Sentry will give you a value which we call a DSN or Data Source Name. It looks a lot like a standard URL, but it’s just a representation of the configuration required by the Sentry SDKs. It consists of a few pieces, including the protocol, public key, the server address, and the project identifier.
You should initialize the SDK as early as possible, for an example, the start of OnCreate on MainActivity for Android, and, the top of FinishedLaunching on AppDelegate for iOS).
// Tells which project in Sentry to send events to:
o.Dsn = "https://examplePublicKey@o0.ingest.sentry.io/0";
// When configuring for the first time, to see what the SDK is doing:
o.Debug = true;
// Set TracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
o.TracesSampleRate = 1.0;
// App code
Great! Now that you’ve completed setting up the SDK, maybe you want to quickly test out how Sentry works. Start by capturing an exception:
You can verify Sentry is capturing unhandled exceptions by raising an exception. For example, you can use the following snippet to raise a
All you need to do is to initialize the SDK with
SentryXamarin.Init, you will not need any additional changes to get the SDK ready to go.
The SDK automatically handles
Application.UnhandledException, so you'll not need to worry about trying to Catch Unhandled Exceptions.
The following options are only going to be valid during the SDK initialization.
Disable the native event processor for Android,iOS,UWP
By calling it, the SDK will not automatically Cache your events and they might be lost if a hard crash happens or no connectivity is available during the transport of the event.
Automatically attaches a screenshot of the app at the time of the event capture. By default, it is set to false.
Disables the automatic Logging of internal Warnings that comes from Xamarin Forms.
For information about Troubleshooting, please visit the troubleshooting page.
- An example using Xamarin Forms and most of the SDK features. (Android, iOS, UWP)