Skip to content

(MAUI) user.id is always set and can't remove it with SendDefaultPii or null #4172

@lucas-zimerman

Description

@lucas-zimerman

Linear:
NET-492

Package

Sentry

.NET Flavor

.NET

.NET Version

9.0.4

OS

Android

OS Version

No response

Development Environment

Visual Studio v17.x

SDK Version

5.6.0

Self-Hosted Sentry Version

24.8.0

Workload Versions

A break change that I noticed from the Xamarin SDK to MAUI is that User.id is always set.

SendDefaultPii does nothing when set to false, it keeps sending this identifier, and there doesn't seems to be an easy way remove.

Even with

            SentrySdk.CaptureMessage("teste user id", scope =>
            {
                scope.User.Id = null;
            });

it still sends an event with an user.id

Image

Image

UseSentry or SentrySdk.Init call

        builder.UseSentry((option) =>
        {
            option.ReportAssembliesMode = ReportAssembliesMode.None;
            option.Dsn = EnvironmentConfig.SentryDsn;
            option.AutoSessionTracking = false;
            option.TracesSampleRate = 1.0;
            option.AddEventProcessor(new SentryEventProcessor());
            option.AddExceptionProcessor(new SentryExceptionProcessor());
            option.AddExceptionFilterForType<InvalidSessionException>();
            option.Environment = EnvironmentConfig.AppEnvironment.ToString();
            option.AttachScreenshot = true;
            option.SendDefaultPii = false;
            option.SetBeforeScreenshotCapture(BeforeScreenshotCapture);
            if (EnvironmentConfig.AppEnvironment == EAppEnvironment.Prod)
            {
                option.MaxBreadcrumbs = 50;
            }
#if DEBUG
            option.Debug = true;
#endif
        });

Steps to Reproduce

  • Don't set user.id
    And one of the following options:
    1. Set user.id as null on configure scope or inside the capture message scope.
    1. Have SendDefaultPii as false.
    1. Using
SentrySdk.ConfigureScope(scope =>
{
   scope.User = new SentryUser();
});

One of the above options should unset the user.id from any event.

Expected Result

user.id not set with installationID

Actual Result

events with user.id not set by the developer

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .net codeBugSomething isn't workingErrors
    No fields configured for issues without a type.

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions