Skip to content

DefaultTags from SentryUnityOptions are not propagated to native crash events #2668

Closed
getsentry/sentry-dotnet
#5214

Description

@saadk408

What problem could Sentry solve that it doesn't?

Problem Statement

Tags configured via options.DefaultTags on SentryUnityOptions are correctly attached to managed (C#) error events, but they are missing from native crash events (Android NDK, iOS, etc.). Users who rely on DefaultTags to slice, filter, group, and alert on their data in Sentry lose that ability the moment a crash is captured by the native layer instead of the managed layer, which is exactly when that context is most needed.

Given a configuration like:

private static void AddDefaultTags(SentryUnityOptions options)
{
    options.DefaultTags.Add(ApplicationVersionStringKey, "1.1.1");
    // ...additional default tags
}
  • Managed C# events (handled exceptions, SentrySdk.CaptureException, log integrations, etc.) arrive in Sentry with the configured default tags.
  • Native crash events (e.g. SIGSEGV / SIGABRT captured by sentry-native on Android or iOS) arrive without those tags.

Why the Current Behavior Is Insufficient

DefaultTags is the primary configuration surface for users to attach build-level metadata (app version, build number, deployment ring, store channel, region, A/B variant, etc.) to every event. The implicit and documented contract is that default tags show up on every event.

Native crashes are typically the highest-priority events users want to triage. Missing tags forces them to either set the same tags a second time via SentrySdk.ConfigureScope (which duplicates configuration and is easy to forget), or lose the ability to filter, group, or alert on native crashes by those dimensions entirely.

The root cause appears to be a scope sync gap. DefaultTags is applied at the managed event-processing layer but is not pushed down to the native scope before a native crash is captured. Native crashes are written by sentry-native from a signal handler and can only see whatever scope was synced ahead of time. The existing scope sync path (IScopeObserver in sentry-java, equivalent on Cocoa) handles tags set via SentrySdk.ConfigureScope, but tags coming from options.DefaultTags do not appear to be funneled through that same path.

Related: [getsentry/sentry-dotnet#3855 (comment)] reports the same root cause family on the .NET MAUI Android side.

Proposed Solutions or Approaches

The user-facing requirement is that DefaultTags appear on every event the SDK sends, including native crashes. One direction worth considering is propagating DefaultTags through the existing managed-to-native scope sync at init time, so they ride the same path as tags set via ConfigureScope. Open to whatever approach the team thinks is right.

Platforms Affected

Android, iOS, and any other platform where a native crash backend is active.

Activity

  1. added
    Feature
    Unity
    Errors
    on May 6, 2026
  2. linear-code commented on May 6, 2026

    @linear-code
  3. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on May 6, 2026
  4. aowen-sd commented on May 6, 2026

    @aowen-sd

    🙏

    If this feature request is implemented to include Tags, instead of just Default Tags, that's a bonus! But Default Tags felt more "standard" and easier to thread through.

  5. bitsandfoxes commented on May 7, 2026

    @bitsandfoxes
    Contributor

    Thanks for raising this! This looks like a gap in the way we sync the scope to the native layer after it's been initialized. Let me see how we can patch that.

  6. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on May 7, 2026
  7. bitsandfoxes commented on Jun 3, 2026

    @bitsandfoxes
    Contributor

    This has been resolved and is part of the 4.4.0 release. Thanks again for reaching out!

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

    4. LowErrorsFeatureUnity

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions