Skip to content

feat!: SentryOptions.ScopeObserver, EnableScopeSync and CrashedLastRun are now internal - #5631

Merged
jamescrosswell merged 1 commit into
version7from
internal-sdk-options
Sep 29, 2026
Merged

jamescrosswell merged 1 commit into
version7from
internal-sdk-options

Conversation

@jamescrosswell

Copy link
Copy Markdown
Collaborator

Makes SentryOptions.ScopeObserver, EnableScopeSync and CrashedLastRun internal.

These options only exist so Sentry SDKs can wire up scope sync and crash detection: the Android, Cocoa and Native integrations here, and the Unity SDK. They were public only so Unity could set them, and Unity now has InternalsVisibleTo access instead (discussion).

Notes for review

  • Unity's InternalsVisibleTo list is widened. Unity doesn't only set these options from Sentry.Unity. It also sets them from Sentry.Unity.Android, Sentry.Unity.iOS and Sentry.Unity.Native, and reads them in Sentry.Unity.Android.Tests and Sentry.Unity.iOS.Tests. None of those were in Sentry.Unity.props, so they're added there to keep Unity compiling.
  • EnableScopeSync no longer binds from configuration. It's removed from BindableSentryOptions, so an EnableScopeSync key in appsettings.json is now ignored.
  • IScopeObserver stays public. Unity's public ScopeObserver base class implements it.

Closes #4529

🤖 Generated with Claude Code

…astRun` are now internal

These options only exist so Sentry SDKs can wire up scope sync and crash
detection: the Android, Cocoa and Native integrations here, and the Unity SDK.
They were public so Unity could set them, but Unity has InternalsVisibleTo
access, so they no longer need to be public API.

`EnableScopeSync` can no longer be bound from configuration.

Unity sets these options from its platform assemblies too, so those are
added to the InternalsVisibleTo list in Sentry.Unity.props.

Closes #4529

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (version7@aa02031). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             version7    #5631   +/-   ##
===========================================
  Coverage            ?   74.76%           
===========================================
  Files               ?      515           
  Lines               ?    18903           
  Branches            ?     3688           
===========================================
  Hits                ?    14133           
  Misses              ?     3892           
  Partials            ?      878           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bitsandfoxes double checking if this is OK. Do these properties ever need to be set via configuration bindings? I'm assuming not...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bitsandfoxes I'll merge this in (assuming it's unlikely to cause an issue for you guys).

Let us know otherwise and we can revisit/revert if necessary.

@jamescrosswell
jamescrosswell marked this pull request as ready for review September 28, 2026 01:31
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Sep 28, 2026

@ric-oliv ric-oliv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can wait for Stefan, but it LGTM :)

@jamescrosswell
jamescrosswell merged commit 54448e7 into version7 Sep 29, 2026
42 checks passed
@jamescrosswell
jamescrosswell deleted the internal-sdk-options branch September 29, 2026 22:20
jamescrosswell added a commit that referenced this pull request Sep 29, 2026
Picks up #5631 (ScopeObserver, EnableScopeSync and CrashedLastRun are now internal), which
landed while main was being merged in. Its API snapshot removals and the additions this merge
brought from main are in different places, so the snapshots merged cleanly; verified by
re-running ApiApprovalTests rather than trusting the textual merge.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jamescrosswell added a commit that referenced this pull request Sep 29, 2026
…t-5245' into feat/no-init-from-logging-mel-5245

Picks up version7 (which now has main merged in) plus #5573 and the NLog and log4net branches.

test/Sentry.Extensions.Logging.Tests/SentryLoggingOptionsSetupTests.cs was the only textual
conflict, and kept this branch's side: the test asserts only MinimumBreadcrumbLevel and
MinimumEventLevel because SentryLoggingOptions no longer derives from SentryOptions, so the
core SDK properties the other side binds don't exist on it. version7's only change to that
file was #5631 removing three assertions this version never makes.

Two things merged cleanly but did not compile, where main's new log entry filters meet this
branch's options split:

- Main moved the category, EF and filter checks out of ShouldCaptureEvent into their own early
  return, leaving it level-only, so the runtime warning's gate no longer had a 3-argument
  overload to call. It now goes through WouldCaptureEvent, which mirrors the real path.
- SentryLogger reported a failing filter callback via _options.LogError, which only resolves
  while SentryLoggingOptions is a SentryOptions. It now reports through the hub's options,
  matching how the structured logger reads its defaults on this branch. The two tests covering
  it set the diagnostic logger substitute on the hub's options instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jamescrosswell added a commit to getsentry/sentry-docs that referenced this pull request Oct 13, 2026
)

## DESCRIBE YOUR PR

Documents `SentryOptions.OnCrashedLastRun` for the .NET SDK. The [Apple
guide's setup
snippet](https://docs.sentry.io/platforms/dotnet/guides/apple/#configure)
already sets it, but no options page described it.

The entry goes in the Hooks section of the shared .NET options page,
wrapped in a `PlatformSection` so it only shows for the Apple and MAUI
guides. It covers when the callback runs and which event it receives,
and notes that it's iOS and Mac Catalyst only.

Notes for review:

- `SentryOptions.CrashedLastRun` is deliberately left out. It was only
public so the Unity SDK could set it, and getsentry/sentry-dotnet#5631
makes it internal in 7.0.0.
- The behaviour described comes from the SDK source: the .NET callback
wraps the Cocoa SDK's `onCrashedLastRun`. Cocoa only calls that once per
run, for a fatal event, after `beforeSend` and event processors. So a
crash event dropped by `SampleRate`, `SetBeforeSend` or
`Native.SuppressSignalAborts` doesn't trigger it. Regular crash reports
are processed on a background queue.
- The entry is accurate for both 6.x and 7.0. The API and its wiring are
unchanged on `version7`, and both branches use Cocoa 9.30.x.

Closes getsentry/sentry-dotnet#5301

## IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs
to go live.
Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the
due date. You can update this information later by editing the PR
description.

- [ ] Urgent deadline (GA date, etc.): YYYY-MM-DD
- [ ] Other deadline: YYYY-MM-DD
- [x] No deadline: Not urgent, can wait up to 1 week+

## PRE-MERGE CHECKLIST

_Make sure you've checked the following before merging your changes:_

- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Ricardo Colombo Oliveira <github@ricoliv.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants