Skip to content

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

@saadk408

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    4. LowErrorsissues relates to the error reporting productFeaturenew featureUnityplatform label
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions