Skip to content

MAUI: CreateElementEventsBreadcrumbs set in code is overwritten with false #5859

Closed

Description

@jamescrosswell

Package

Sentry.Maui

Description

Enabling CreateElementEventsBreadcrumbs in code has no effect:

builder.UseSentry(options =>
{
    options.Dsn = "...";
    options.CreateElementEventsBreadcrumbs = true; // silently reset to false
});

BindableSentryMauiOptions.CreateElementEventsBreadcrumbs is initialised to false instead of being left null:

https://github.com/getsentry/sentry-dotnet/blob/193656ca1/src/Sentry.Maui/BindableSentryMauiOptions.cs#L11

so ApplyTo always writes false unless the key is present in configuration:

options.CreateElementEventsBreadcrumbs = CreateElementEventsBreadcrumbs ?? options.CreateElementEventsBreadcrumbs;

UseSentry registers the user's configureOptions delegate before SentryMauiOptionsSetup, and options setups run in registration order, so the configuration pass overwrites the value set in code. Setting it via appsettings.json (Sentry:CreateElementEventsBreadcrumbs) still works.

Found by reading the code. The = false dates from #2900 and looks like it was copied from SentryMauiOptions, where the default is harmless.

Fix

Drop the initialiser so the bindable property defaults to null, like every other bindable property.

A test along the lines of UseSentry_WithCaching_CanChangeCacheDirectoryPath in SentryMauiAppBuilderExtensionsTests should fail today and pass with the fix:

builder.UseSentry(options => options.CreateElementEventsBreadcrumbs = true);
using var app = builder.Build();
var options = app.Services.GetRequiredService<IOptions<SentryMauiOptions>>().Value;
Assert.True(options.CreateElementEventsBreadcrumbs);

Activity

  1. added
    BugSomething isn't working
    .NETPull requests that update .net code
    on Nov 2, 2026
  2. linear-code commented on Nov 2, 2026

    @linear-code
  3. added a commit that references this issue on Nov 4, 2026
    f1a29b1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .net codeBugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions