Sentry.Xamarin 2.0.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Sentry.Xamarin --version 2.0.0
NuGet\Install-Package Sentry.Xamarin -Version 2.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Sentry.Xamarin" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sentry.Xamarin --version 2.0.0
#r "nuget: Sentry.Xamarin, 2.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Sentry.Xamarin as a Cake Addin
#addin nuget:?package=Sentry.Xamarin&version=2.0.0

// Install Sentry.Xamarin as a Cake Tool
#tool nuget:?package=Sentry.Xamarin&version=2.0.0

Sentry

Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoying technology. If you want to join us, check out our open positions.

Sentry SDK for Xamarin

build Discord Chat

Integrations Downloads NuGet Stable NuGet Preview
Sentry.Xamarin.Forms Downloads NuGet NuGet
Sentry.Xamarin Downloads NuGet NuGet

Sentry.Xamarin is the tool to go for Xamarin that enriches your errors with valuable data, like breadcrumbs, tags, issue grouping and more!.

Includes for all Platforms supported by Xamarin Essentials:

  • Automatic Navigation breacrumbs. (Xamarin.Forms)
  • Xaml warnings as breadcrumbs. (Xamarin.Forms)
  • Simulator flag.
  • Device manufacturer.
  • Device model.
  • Operational system name and version.
  • Screen information (Pixel density and resolution).
  • Connectivity status.

Additionaly, Android and IOS will include additional information:

  • Free Internal memory (Android/iOS).
  • Total RAM (Android/iOS).
  • CPU model (Android).

BEFORE

Screenshot of Sentry before applying Sentry.Xamarin

AFTER

Screenshot of Sentry after applying Sentry.Xamarin

Setup

All you need to do is to initialize Xamarin integration by calling SentryXamarin.Init, and, it's recommended to start Sentry Xamarin 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)

SentryXamarin.Init(options =>
{
    options.Dsn = "__YOUR__DSN__";
    options.AddXamarinFormsIntegration();
});

If your app uses Xamarin.Forms you can also use the package Sentry.Xamarin.Forms and initialize the SDK with additional line options.AddXamarinFormsIntegration().

Android

On your MainActivity

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
    protected override void OnCreate(Bundle savedInstanceState)
    {
        SentryXamarin.Init(options =>
        {
            options.Dsn = "__YOUR__DSN__";
            options.AddXamarinFormsIntegration();
        });
        ...

iOS

On AppDelegate.cs

public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        SentryXamarin.Init(options =>
        {
            options.Dsn = "__YOUR__DSN__";
            options.AddXamarinFormsIntegration();
        });
        ...

UWP

On App.Xaml.cs

sealed partial class App : Application
{
    protected override void OnLaunched(LaunchActivatedEventArgs e)
    {
        SentryXamarin.Init(options =>
        {
            options.Dsn = "__YOUR__DSN__";
            options.AddXamarinFormsIntegration();
        });
    ...        

Compatibility

The package requires the following versions or newer:

  • Tizen 4.0 (for Tizen)
  • Xamarin.Android 11.0 (for Android)
  • Xamarin.iOS 10.14 (for iOS)
  • Universal Windows Platform 10.0.16299 (for UWP)
  • Xamarin.Forms 4.6.0.726 (for Xamarin.Forms integration)
  • Xamarin.Essentials 1.4.0
  • Sentry 4.0.3

Resources

  • Documentation
  • Forum
  • Discord Chat
  • Stack Overflow
  • Twitter Follow
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed.  monoandroid11.0 is compatible. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap10.0.16299 is compatible. 
Xamarin.iOS xamarinios was computed.  xamarinios10 is compatible. 
Xamarin.Mac xamarinmac was computed.  xamarinmac20 is compatible. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Sentry.Xamarin:

Package Downloads
Sentry.Xamarin.Forms The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Official Sentry SDK for Xamarin Forms - Open-source error tracking that helps developers monitor and fix crashes in real time.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 962 2/11/2024
2.0.0-beta.1 383 12/18/2023
1.5.2 13,074 6/26/2023
1.5.1 9,375 2/6/2023
1.5.0 6,845 2/1/2023
1.4.6 1,432 1/24/2023
1.4.5 8,323 12/6/2022
1.4.4 5,137 11/4/2022
1.4.3 2,644 10/10/2022
1.4.2 18,129 8/5/2022
1.4.1 17,091 5/9/2022
1.4.0 3,547 4/12/2022
1.3.2 14,724 1/18/2022
1.3.1 13,307 9/11/2021
1.3.0 594 9/9/2021
1.2.0 4,396 7/21/2021
1.1.0 4,372 6/18/2021
1.0.3 8,410 3/4/2021
1.0.2 869 2/14/2021
1.0.1 1,960 2/2/2021
1.0.0 511 1/29/2021
1.0.0-alpha.4 421 1/10/2021

Changes since version 2.0.0-beta.1

Sentry Self-hosted Compatibility:
If you're using `sentry.io` this change does not affect you.
This SDK version is compatible with a self-hosted version of Sentry `22.12.0` or higher. If you are using an older version of [self-hosted Sentry](https://develop.sentry.dev/self-hosted/) (aka on-premise), you will need to [upgrade](https://develop.sentry.dev/self-hosted/releases/).

Significant change in behavior:
- Setting `SentryOptions.Dsn` to `null` now throws `ArgumentNullException` during initialization. ([#2655](https://github.com/getsentry/sentry-dotnet/pull/2655))
- Enable `CaptureFailedRequests` by default ([#2688](https://github.com/getsentry/sentry-dotnet/pull/2688))
- Added `Sentry` namespace to global usings when `ImplicitUsings` is enabled ([#3043](https://github.com/getsentry/sentry-dotnet/pull/3043))
If you have conflicts, you can opt out by adding the following to your `csproj`:
```
<PropertyGroup>
 <SentryImplicitUsings>false</SentryImplicitUsings>
</PropertyGroup>
```
- Transactions' spans are no longer automatically finished with the status `deadline_exceeded` by the transaction. This is now handled by the [Relay](https://github.com/getsentry/relay).
 - Customers self hosting Sentry must use verion 22.12.0 or later ([#3013](https://github.com/getsentry/sentry-dotnet/pull/3013))
- The `User.IpAddress` is now set to `{{auto}}` by default, even when sendDefaultPII is disabled ([#2981](https://github.com/getsentry/sentry-dotnet/pull/2981))
 - The "Prevent Storing of IP Addresses" option in the "Security & Privacy" project settings on sentry.io can be used to control this instead
- The `DiagnosticLogger` signature for `LogWarning` changed to take the `exception` as the first parameter. That way it no longer gets mixed up with the TArgs. ([#2987](https://github.com/getsentry/sentry-dotnet/pull/2987))

API breaking Changes:
If you have compilation errors you can find the affected types or overloads missing in the changelog entries below.

Changed APIs:
- Class renamed `Sentry.User` to `Sentry.SentryUser` ([#3015](https://github.com/getsentry/sentry-dotnet/pull/3015))
- Class renamed `Sentry.Runtime` to `Sentry.SentryRuntime` ([#3016](https://github.com/getsentry/sentry-dotnet/pull/3016))
- Class renamed `Sentry.Span` to `Sentry.SentrySpan` ([#3021](https://github.com/getsentry/sentry-dotnet/pull/3021))
- Class renamed `Sentry.Transaction` to `Sentry.SentryTransaction` ([#3023](https://github.com/getsentry/sentry-dotnet/pull/3023))
- `ITransaction` has been renamed to `ITransactionTracer`. You will need to update any references to these interfaces in your code to use the new interface names ([#2731](https://github.com/getsentry/sentry-dotnet/pull/2731), [#2870](https://github.com/getsentry/sentry-dotnet/pull/2870))
- `DebugImage` and `DebugMeta` moved to `Sentry.Protocol` namespace. ([#2815](https://github.com/getsentry/sentry-dotnet/pull/2815))
- `SentryClient.Dispose` is no longer obsolete ([#2842](https://github.com/getsentry/sentry-dotnet/pull/2842))
- `ISentryClient.CaptureEvent` overloads have been replaced by a single method accepting optional `Hint` and `Scope` parameters. You will need to pass `hint` as a named parameter from code that calls `CaptureEvent` without passing a `scope` argument. ([#2749](https://github.com/getsentry/sentry-dotnet/pull/2749))
- `TransactionContext` and `SpanContext` constructors were updated. If you're constructing instances of these classes, you will need to adjust the order in which you pass parameters to these. ([#2694](https://github.com/getsentry/sentry-dotnet/pull/2694), [#2696](https://github.com/getsentry/sentry-dotnet/pull/2696))
- The `DiagnosticLogger` signature for `LogError` and `LogFatal` changed to take the `exception` as the first parameter. That way it no longer gets mixed up with the TArgs. The `DiagnosticLogger` now also receives an overload for `LogError` and `LogFatal` that accepts a message only. ([#2715](https://github.com/getsentry/sentry-dotnet/pull/2715))
- `Distribution` added to `IEventLike`. ([#2660](https://github.com/getsentry/sentry-dotnet/pull/2660))
- `StackFrame`'s `ImageAddress`, `InstructionAddress`, and `FunctionId` changed to `long?`. ([#2691](https://github.com/getsentry/sentry-dotnet/pull/2691))
- `DebugImage.ImageAddress` changed to `long?`. ([#2725](https://github.com/getsentry/sentry-dotnet/pull/2725))
- Contexts now inherit from `IDictionary` rather than `ConcurrentDictionary`. The specific dictionary being used is an implementation detail. ([#2729](https://github.com/getsentry/sentry-dotnet/pull/2729))
- The method used to configure a Sentry Sink for Serilog now has an additional overload. Calling `WriteTo.Sentry()` with no arguments will no longer attempt to initialize the SDK (it has optional arguments to configure the behavior of the Sink only). If you want to initialize Sentry at the same time you configure the Sentry Sink then you will need to use the overload of this method that accepts a DSN as the first parameter (e.g. `WriteTo.Sentry("https://d4d82fc1c2c4032a83f3a29aa3a3aff@fake-sentry.io:65535/2147483647")`). ([#2928](https://github.com/getsentry/sentry-dotnet/pull/2928))

Removed APIs:
- SentrySinkExtensions.ConfigureSentrySerilogOptions is now internal. If you were using this method, please use one of the `SentrySinkExtensions.Sentry` extension methods instead. ([#2902](https://github.com/getsentry/sentry-dotnet/pull/2902))
- A number of `[Obsolete]` options have been removed ([#2841](https://github.com/getsentry/sentry-dotnet/pull/2841))
 - `BeforeSend` - use `SetBeforeSend` instead.
 - `BeforeSendTransaction` - use `SetBeforeSendTransaction` instead.
 - `BeforeBreadcrumb` - use `SetBeforeBreadcrumb` instead.
 - `CreateHttpClientHandler` - use `CreateHttpMessageHandler` instead.
 - `ReportAssemblies` - use `ReportAssembliesMode` instead.
 - `KeepAggregateException` - this property is no longer used and has no replacement.
 - `DisableTaskUnobservedTaskExceptionCapture` method has been renamed to `DisableUnobservedTaskExceptionCapture`.
 - `DebugDiagnosticLogger` - use `TraceDiagnosticLogger` instead.
- A number of iOS/Android-specific `[Obsolete]` options have been removed ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
 - `Distribution` - use `SentryOptions.Distribution` instead.
 - `EnableAutoPerformanceTracking` - use `SetBeforeSendTransaction` instead.
 - `EnableCoreDataTracking` - use `EnableCoreDataTracing` instead.
 - `EnableFileIOTracking` - use `EnableFileIOTracing` instead.
 - `EnableOutOfMemoryTracking` - use `EnableWatchdogTerminationTracking` instead.
 - `EnableUIViewControllerTracking` - use `EnableUIViewControllerTracing` instead.
 - `StitchAsyncCode` - no longer available.
 - `ProfilingTracesInterval` - no longer available.
 - `ProfilingEnabled` - use `ProfilesSampleRate` instead.
- Obsolete `SystemClock` constructor removed, use `SystemClock.Clock` instead. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
- Obsolete `Runtime.Clone()` removed, this shouldn't have been public in the past and has no replacement. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
- Obsolete `SentryException.Data` removed, use `SentryException.Mechanism.Data` instead. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
- Obsolete `AssemblyExtensions` removed, this shouldn't have been public in the past and has no replacement. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
- Obsolete `SentryDatabaseLogging.UseBreadcrumbs()` removed, it is called automatically and has no replacement. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
- Obsolete `Scope.GetSpan()` removed, use `Span` property instead. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856))
- Obsolete `IUserFactory` removed, use `ISentryUserFactory` instead. ([#2856](https://github.com/getsentry/sentry-dotnet/pull/2856), [#2840](https://github.com/getsentry/sentry-dotnet/pull/2840))
- `IHasMeasurements` has been removed, use `ISpanData` instead. ([#2659](https://github.com/getsentry/sentry-dotnet/pull/2659))
- `IHasBreadcrumbs` has been removed, use `IEventLike` instead. ([#2670](https://github.com/getsentry/sentry-dotnet/pull/2670))
- `ISpanContext` has been removed, use `ITraceContext` instead. ([#2668](https://github.com/getsentry/sentry-dotnet/pull/2668))
- `IHasTransactionNameSource` has been removed, use `ITransactionContext` instead. ([#2654](https://github.com/getsentry/sentry-dotnet/pull/2654))
- ([#2694](https://github.com/getsentry/sentry-dotnet/pull/2694))
- The unused `StackFrame.InstructionOffset` has been removed. ([#2691](https://github.com/getsentry/sentry-dotnet/pull/2691))
- The unused `Scope.Platform` property has been removed. ([#2695](https://github.com/getsentry/sentry-dotnet/pull/2695))
- The obsolete setter `Sentry.PlatformAbstractions.Runtime.Identifier` has been removed ([2764](https://github.com/getsentry/sentry-dotnet/pull/2764))
- `Sentry.Values<T>` is now internal as it is never exposed in the public API ([#2771](https://github.com/getsentry/sentry-dotnet/pull/2771))
- The `TracePropagationTarget` class has been removed, use the `SubstringOrRegexPattern` class instead. ([#2763](https://github.com/getsentry/sentry-dotnet/pull/2763))
- The `WithScope` and `WithScopeAsync` methods have been removed. We have discovered that these methods didn't work correctly in certain desktop contexts, especially when using a global scope. ([#2717](https://github.com/getsentry/sentry-dotnet/pull/2717))
 Replace your usage of `WithScope` with overloads of `Capture*` methods:
 - `SentrySdk.CaptureEvent(SentryEvent @event, Action<Scope> scopeCallback)`
 - `SentrySdk.CaptureMessage(string message, Action<Scope> scopeCallback)`
 - `SentrySdk.CaptureException(Exception exception, Action<Scope> scopeCallback)`
 ```c#
 // Before
 SentrySdk.WithScope(scope =>
 {
   scope.SetTag("key", "value");
   SentrySdk.CaptureEvent(new SentryEvent());
 });
 // After
 SentrySdk.CaptureEvent(new SentryEvent(), scope =>
 {
   // Configure your scope here
   scope.SetTag("key", "value");
 });
 ```
-->
     See full changelog at https://github.com/getsentry/sentry-xamarin/blob/main/CHANGELOG.md