Skip to content

Native AOT crashes have no release when it comes from the .NET default #5648

Description

@jamescrosswell

Description

On Native AOT, SentrySdk.InitHub resolves the environment before it initialises sentry-native, but not the release (resolve, init). CFunctions passes a release to sentry-native only when SentryOptions.Release is set (source), and IScopeObserver has no way to set one afterwards.

sentry-native falls back to the SENTRY_RELEASE environment variable by itself (source). What it never receives is the .NET SDK's default release, which is the entry assembly's name@version from SettingLocator.GetRelease.

Impact

Suppose an app sets neither SentryOptions.Release nor SENTRY_RELEASE:

  • Managed events carry name@version.
  • Every native crash, for the lifetime of the process, arrives with no release, so it isn't attributed to any release.

Expected

sentry-native is initialised with the same release that managed events use.

Notes

The fix should be limited to the Native path; resolving the release earlier for every platform isn't safe.

Found while designing #5197, which would also fix this by resolving the release once, before native init.

Activity

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 codeAOTBugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions