fix(ios): honor _experiments.enableUnhandledCPPExceptionsV2 on v8#6014
Merged
fix(ios): honor _experiments.enableUnhandledCPPExceptionsV2 on v8#6014
Conversation
`RNSentryStart.createOptionsWithDictionary` (the live iOS init path since v8.0.0) did not read `_experiments.profilingOptions`, silently dropping `profileSessionSampleRate`, `lifecycle`, and `startOnAppStart`. The handling existed in `SentrySDKWrapper`, but that surface hasn't been called from `initNativeSdk` since #5582 — #5611 added the block to the wrong file. Port the handling to `RNSentryStart` and add XCTest coverage for the `startWithOptions` entry point that `initNativeSdk` uses, so this regression can't slip through again. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Rewrite CHANGELOG entry to match the descriptive + PR-link format. - Strengthen the two positive profiling tests to invoke the installed callback on a fresh SentryProfileOptions probe and assert that sessionSampleRate, lifecycle, and profileAppStarts land correctly, so a future regression that installs an incomplete callback is caught. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Same dead-code issue as the profiling fix — `SentrySDKWrapper` parses `_experiments.enableUnhandledCPPExceptionsV2`, but `RNSentryStart` (the live init path since v8.0.0) does not. Port the handling into the `_experiments` block just introduced for `profilingOptions`, and add enabled/disabled/default XCTest coverage on `RNSentryStart`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
…ios-cpp-exceptions-v2 # Conflicts: # CHANGELOG.md
7 tasks
This was referenced Apr 17, 2026
📲 Install BuildsAndroid
|
Contributor
iOS (legacy) Performance metrics 🚀
|
Contributor
iOS (new) Performance metrics 🚀
|
alwx
approved these changes
Apr 17, 2026
Contributor
…xceptions-v2 # Conflicts: # packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m # packages/core/ios/RNSentryStart.m
This was referenced Apr 23, 2026
7 tasks
7 tasks
antonis
added a commit
that referenced
this pull request
Apr 29, 2026
* refactor(ios): remove dead SentrySDKWrapper init surface `SentrySDKWrapper.createOptionsWithDictionary:isSessionReplayEnabled:error:` (and `setupWithDictionary:`, `startWithOptions:`, `enableAutoSessionTracking`, `enableWatchdogTerminationTracking`) became dead when v8 moved init to `RNSentryStart` (#5582 / #4442). The dead methods had a parallel test suite that kept passing, which is exactly how the bugs in #6012 and #6014 shipped: new code was added to `SentrySDKWrapper` because the tests there made it look like the live surface. Delete the dead methods, migrate the still-relevant test coverage to `RNSentryStart`-based tests, drop duplicate tests already pinned on `RNSentryStart`. `SentrySDKWrapper.h` is not in the podspec's `public_header_files`, so no downstream consumers are affected. The kept methods (`configureScope:`, `crash`, `close`, `crashedLastRun`, `debug`, `releaseName`) continue to be used from `RNSentry.mm`. Closes #6015. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(test): drop duplicate testStartBeforeBreadcrumbs… method The migration in the previous commit added a `testStart…KeepsBreadcrumbWhenDevServerUrlIsNotPassed…` method that already existed in the `RNSentryStart Tests` block. Compile failed in CI with "Duplicate declaration of method". The earlier `@interface RNSentryStart Tests` already covers this scenario; the migrated copy is redundant. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(test): use designated initializers for SentryException and SentryMessage Warden flagged the migrated tests using `[SentryException alloc]` and `[SentryMessage alloc]` without `init`. Both classes have `SENTRY_NO_INIT` and require designated initializers (`initWithValue:type:` and `initWithFormatted:`), so the alloc-only pattern is undefined behavior — property assignments happened to work via zero-initialized memory but the test could crash or behave inconsistently and mask real regressions. The pattern was inherited from the original SentrySDKWrapper-based tests this PR migrated; same fix applied across all 12 occurrences. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Note
Stacked on #6012. Review/merge that one first; once it lands, rebase this onto
main.📢 Type of change
📜 Description
Same dead-code drift as the profiling fix in #6012.
SentrySDKWrapper.createOptionsWithDictionaryparses_experiments.enableUnhandledCPPExceptionsV2intosentryOptions.experimental.enableUnhandledCPPExceptionsV2(ios/SentrySDKWrapper.m:105-108), butSentrySDKWrapperhas not been on the live init path since #5582 moved init toRNSentryStart. So on iOS this option has been silently ignored in every 8.x release — userSentry.init({ _experiments: { enableUnhandledCPPExceptionsV2: true } })does not reach Cocoa.(Verified Cocoa's
SentryOptionsInternal.mdoes not auto-map_experiments.*from the raw dictionary — only top-level keys likeenableLogs. So the gap is real.)This PR extends the
_experimentsblock introduced in #6012 to also portenableUnhandledCPPExceptionsV2handling. Adds enabled / disabled / default XCTest coverage onRNSentryStart, mirroring the coverageSentrySDKWrapperalready had but on the live path.💡 Motivation and Context
User-facing: with
enableUnhandledCPPExceptionsV2: trueset in JS, iOS still falls back to the default handler, so C++ crashes don't get the more reliable__cxa_throwhooking. Same class of silent drop as the profiling regression — same fix pattern.💚 How did you test it?
RNSentryStart:testStartCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Enabled→ assertsactualOptions.experimental.enableUnhandledCPPExceptionsV2 == YES…Disabled→ asserts== NO…Default(no_experimentskey) → asserts== NOyarn build,yarn circularDepCheck,./scripts/clang-format.sh lintall clean.📝 Checklist
sendDefaultPIIis enabled🔮 Next steps