Skip to content

Latest commit

 

History

History
125 lines (81 loc) · 5.12 KB

File metadata and controls

125 lines (81 loc) · 5.12 KB
title sdk description
MAUI
sentry.dotnet.maui
Learn about Sentry's .NET integration with .NET 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
  • Native crash reporting for iOS and Mac Catalyst, leveraging our Cocoa SDK for iOS
  • Managed crash reporting (unhandled exceptions), on all MAUI platforms (iOS, Android, Windows, Mac Catalyst, and Tizen)
  • Line numbers for your .NET stack traces when PDBs are uploaded to Sentry
  • Automatic breadcrumbs for MAUI app lifecycle and UI events
  • Detailed device and runtime information passed on every event
  • Automatic session tracking enabled, to support release health

Features

In addition to capturing errors, you can monitor interactions between multiple services or applications by enabling tracing.

Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.

Install

<OnboardingOptionButtons options={['error-monitoring', 'performance']}/>

Add the Sentry dependency to your .NET MAUI application:

dotnet add package Sentry.Maui -v {{@inject packages.version('sentry.dotnet.maui') }}
Install-Package Sentry.Maui -Version {{@inject packages.version('sentry.dotnet.maui') }}

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.

public static MauiApp CreateMauiApp()
{
    var builder = MauiApp.CreateBuilder();
    builder
        .UseMauiApp<App>()

        // Add this section anywhere on the builder:
        .UseSentry(options =>
        {
            // The DSN is the only required setting.
            options.Dsn = "___PUBLIC_DSN___";

            // Use debug mode if you want to see what the SDK is doing.
            // Debug messages are written to stdout with Console.Writeline,
            // and are viewable in your IDE's debug console or with 'adb logcat', etc.
            // This option is not recommended when deploying your application.
            options.Debug = true;

            // Adds request URL and headers, IP and name for users, etc.
            options.SendDefaultPii = true;

            // ___PRODUCT_OPTION_START___ performance
            // Set TracesSampleRate to 1.0 to capture 100% of transactions for tracing.
            // We recommend adjusting this value in production.
            options.TracesSampleRate = 1.0;
            // ___PRODUCT_OPTION_END___ performance

            // Other Sentry options can be set here.
        })

        // ... the remainder of your MAUI app setup

    return builder.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.

Use caution when enabling, as such values may contain personally identifiable information (PII).

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.

Use caution when enabling, as such values may contain personally identifiable information (PII).

IncludeBackgroundingStateInBreadcrumbs

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

Use caution when enabling, as such values may contain personally identifiable information (PII).

Verify

This snippet includes an intentional error, so you can test that everything is working as soon as you set it up.