feat: sync environment to the native layers - #5365
#5365Merged
jamescrosswell merged 15 commits intoJul 15, 2026
maingetsentry/sentry-dotnet:mainfrom
feat/sync-scope-environmentgetsentry/sentry-dotnet:feat/sync-scope-environmentCopy head branch name to clipboard
Merged
feat: sync environment to the native layers#5365jamescrosswell merged 15 commits intomaingetsentry/sentry-dotnet:mainfrom feat/sync-scope-environmentgetsentry/sentry-dotnet:feat/sync-scope-environmentCopy head branch name to clipboard
environment to the native layers#5365jamescrosswell merged 15 commits into
maingetsentry/sentry-dotnet:mainfrom
feat/sync-scope-environmentgetsentry/sentry-dotnet:feat/sync-scope-environmentCopy head branch name to clipboard
Conversation
bitsandfoxes
marked this pull request as draft
July 9, 2026 17:41
Flash0ver
reviewed
Jul 9, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5365 +/- ##
==========================================
- Coverage 74.25% 74.23% -0.02%
==========================================
Files 509 509
Lines 18420 18435 +15
Branches 3606 3610 +4
==========================================
+ Hits 13677 13685 +8
- Misses 3869 3875 +6
- Partials 874 875 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…entry/sentry-dotnet into feat/sync-scope-environment
bitsandfoxes
marked this pull request as ready for review
July 13, 2026 08:01
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 490cc8f. Configure here.
This was referenced Jul 27, 2026
evgenygunko
pushed a commit
to evgenygunko/CopyWordsDA
that referenced
this pull request
Jul 27, 2026
> ℹ️ **Note** > > This PR body was truncated due to platform limits. This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [Sentry.Maui](https://sentry.io/) ([source](https://github.com/getsentry/sentry-dotnet)) | `6.7.0` → `6.8.0` |  |  | --- ### Release Notes <details> <summary>getsentry/sentry-dotnet (Sentry.Maui)</summary> ### [`v6.8.0`](https://github.com/getsentry/sentry-dotnet/blob/HEAD/CHANGELOG.md#680) [Compare Source](getsentry/sentry-dotnet@6.7.0...6.8.0) ##### Features ✨ ##### Logs - feat(logs): add `log4net` integration by [@​Flash0ver](https://github.com/Flash0ver) in [#​5172](getsentry/sentry-dotnet#5172) - feat(logs): add `NLog` integration by [@​Flash0ver](https://github.com/Flash0ver) in [#​5176](getsentry/sentry-dotnet#5176) ##### Other - feat(serilog): support restrictedToMinimumLevel when configuring Serilog in code by [@​jamescrosswell](https://github.com/jamescrosswell) in [#​5181](getsentry/sentry-dotnet#5181) - Attachments can now be sent with transactions by setting `AddToTransactions` on `SentryAttachment` [#​5182](getsentry/sentry-dotnet#5182) by [@​jamescrosswell](https://github.com/jamescrosswell) in [#​5182](getsentry/sentry-dotnet#5182) - Added `SentrySdk.RecordTransaction` to record already-completed transactions and spans (e.g. replayed through a proxy) [#​5333](getsentry/sentry-dotnet#5333) by [@​jamescrosswell](https://github.com/jamescrosswell) in [#​5333](getsentry/sentry-dotnet#5333) - The `Environment` set on the `Scope` now gets synchronized to the native layers (`sentry-cocoa` and `sentry-native`) by [@​bitsandfoxes](https://github.com/bitsandfoxes) in [#​5365](getsentry/sentry-dotnet#5365) ##### Fixes 🐛 - fix: `SentrySpanProcessor` no longer leaks spans whose Activity never ends (e.g. aborted requests); the Activity is now held via a `WeakReference` so orphaned spans are pruned once it is garbage-collected. by [@​Ermabo](https://github.com/Ermabo) in [#​5393](getsentry/sentry-dotnet#5393) - The SDK was incorrectly ignoring server rate limits for errors, check-ins, and logs by [@​jamescrosswell](https://github.com/jamescrosswell) in [#​5412](getsentry/sentry-dotnet#5412) - fix: BackpressureMonitor.Dispose() no longer deadlocks on single-threaded targets by [@​jamescrosswell](https://git...
This was referenced Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5385
The scope exposes
Environmentto be overwritten after initialization by the user. This needs to be propagated to the respective native layers. API available onsentry-native✅sentry-cocoa✅sentry-javaneeds to be followed up on.We need to make sure that whatever it is that the SDK will end up setting on an event is also available on the native layer. The
Enricherlazily guarantees that the context is getting populated, so clearing the Scope needs to restore the native scope to the fallback.Initially, I thought we needed to have the
Scopefetch and set theEnvironmentfrom the options on the backing field in the constructor. The idea was that we'd avoid any duplicate scope sync. But this would only be an issue on non-global-mobe platforms, and those don't have scope sync in the first place.So we can "get away" with simply having
Environmentbe a smarter property.Changelog Entry
The
Environmentset on theScopenow gets synchronized to the native layers (sentry-cocoaandsentry-native)