Multi-platform App UI (MAUI)

Sentry has an integration for the .NET Multi-platform App UI (MAUI) through the Sentry.Maui NuGet package.

Overview of the features

  • Easy MAUI integration by calling UseSentry on your MauiAppBuilder
  • All the features of our main .NET SDK, for your managed code
  • Native crash reporting for Android, leveraging our Android SDK
  • Managed crash reporting (unhandled exceptions), on any MAUI platform
  • Automatic breadcrumbs for MAUI app lifecycle and UI events
  • Detailed device and runtime information passed on every event
  • ... more coming soon!

Preview Status

The Sentry.Maui SDK is currently in public preview. All APIs added by this package are subject to breaking changes. We appreciate your feedback:

This documentation will be updated as we get closer to general availability release.

Installation

Add the Sentry dependency to your .NET MAUI application:

Copied
dotnet add package Sentry.Maui --prerelease

This package extends Sentry.Extensions.Logging. This means that besides the MAUI related features, through this package you'll also get access to all the framework's logging integration and also the features available in the main Sentry SDK.

Configure

In your MauiProgram.cs file, call UseSentry on your MauiAppBuilder, and include any options you would like to set. The Dsn is the only required parameter.

For example:

Copied
public static MauiApp CreateMauiApp() =>
    MauiApp.CreateBuilder()
        .UseMauiApp<App>()
        .UseSentry(options =>
        {
            options.Dsn = "https://examplePublicKey@o0.ingest.sentry.io/0";
        })
        // The remainder of your configuration
        .Build();
}

Options

As previously mentioned, this package is a wrapper around Sentry.Extensions.Logging and Sentry. Please refer to the documentation of these packages to get the options that are defined at those levels.

Below, the options that are specific to Sentry.Maui will be described.

IncludeTextInBreadcrumbs

This option controls whether elements that implement the IText interface (such as Button, Label, Entry, and others) will have their text included on breadcrumbs. This option is disabled by default.

IncludeTitleInBreadcrumbs

This option contols whether elements that implement the ITitledElement interface (such as Window, Page, and others) will have their titles included on breadcrumbs. This option is disabled by default.

IncludeBackgroundingStateInBreadcrumbs

Controls whether the breadcrumb sent for the Window.Backgrounding event will include state data from BackgroundingEventArgs.State. This option is disabled by default.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").