ref: migrate Cocoa bindings from PrivateSentrySDKOnly to SentryObjCSDK.internal - #5409
Merged
Conversation
…ternal Opens the branch/PR for the phased migration off the deprecated PrivateSentrySDKOnly hybrid API (#5331). Phases land as subsequent commits. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Phase 1 of migrating the Cocoa hybrid API off the deprecated PrivateSentrySDKOnly to the structured SentryObjCSDK.internal API. - build-sentry-cocoa.sh now also builds the SentryObjC and SentryObjCCompat schemes from source into thin xcframeworks (iOS, iOS-sim, Mac Catalyst). These dynamically link the existing Sentry.framework rather than embedding their own copy of the SDK, so they don't duplicate it - unlike the self-contained released SentryObjC-Dynamic.xcframework. - generate-cocoa-bindings.ps1 feeds the SentryObjC entry-point, internal-API, and id headers to Objective Sharpie. - patch-cocoa-bindings.cs keeps the new interfaces and trims SentryObjCSDK to its `internal` accessor and SentryObjCInternalApi to the members the .NET wrappers use (sdk, profiling, setTrace, ignoreNextSignal). - Sentry.Bindings.Cocoa.csproj bundles the two new frameworks via NativeReference. PrivateSentrySDKOnly is kept in parallel; call sites migrate in phase 2. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5409 +/- ##
==========================================
+ Coverage 74.58% 74.61% +0.02%
==========================================
Files 512 512
Lines 18666 18672 +6
Branches 3659 3657 -2
==========================================
+ Hits 13922 13932 +10
+ Misses 3869 3866 -3
+ Partials 875 874 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Phase 2: repoint the SentryCocoaHybridSdk alias from PrivateSentrySDKOnly to SentryObjCSDK and move the five call sites onto the new instance-based API: - SetSdkName -> Internal.Sdk.Name = - SetTrace -> Internal.SetTrace (using the new SentryObjCId / SentryObjCSpanId) - StartProfilerForTrace -> Internal.Profiling.StartFor - CollectProfileBetween -> Internal.Profiling.CollectBetweenStartTime - IgnoreNextSignal -> Internal.IgnoreNextSignal MiscExtensions gains ToCocoaObjCId / ToCocoaObjCSpanId for the new id types and drops the now-unused ToCocoaSentryId / ToCocoaSpanId. Sentry builds for net10.0-ios26 and net10.0-maccatalyst26 with no warnings. PrivateSentrySDKOnly is still bound (removed in phase 3). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The 10.0.302 workload ships the iOS SDK pack 26.5.10301, which requires Xcode 26.6. CI was pinning Xcode 26.5, causing iOS/MacCatalyst builds and device tests to fail. The macos-26 runner already used by these jobs has Xcode 26.6 available, so switch the pin to it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Dependabot bumped only codeql-action/init to 4.37.1, leaving analyze on 4.37.0. CodeQL requires all steps use the same version, so analyze failed with "Loaded a configuration file for version '4.37.1', but running version '4.37.0'". Pin analyze to the same v4.37.1 SHA. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…grate-private-sentrysdk-only-5331
xcodebuild embeds each framework's dynamic dependencies under <Framework>.framework/Frameworks/, producing deeply nested paths (SentryObjC.framework/Frameworks/SentryObjCCompat.framework/Frameworks/Sentry.framework) that exceed NuGet's path-length limit and fail packing with NU5123. We bundle Sentry, SentryObjCCompat and SentryObjC as separate NativeReferences (each embedded into the consuming app and resolved via @rpath), so the nested copies are redundant. Strip them after building the xcframeworks. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The new SentryObjCSDK.internal profiling API returns an immutable NSDictionary, whereas the old PrivateSentrySDKOnly.collectProfileBetween returned a mutable one. CocoaProfiler.Collect mutates the payload (adds transaction id/trace_id/ name/timestamp), which threw NotSupportedException on the immutable dictionary and failed Profiler_RunningUnderFullClient_SendsProfileData. Copy it into an NSMutableDictionary first. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The app bundle now contains the SentryObjC and SentryObjCCompat frameworks alongside Sentry.framework, so sentry-cli uploads their debug symbols too. Add them to the expected upload list. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Phase 3: all call sites migrated to SentryObjCSDK.internal in the previous phase, so drop the deprecated PrivateSentrySDKOnly interface entirely - the header no longer feeds Objective Sharpie, the patch rules that shaped it are gone, and the regenerated ApiDefinitions.cs loses the interface (pure removal, no other changes). sentry-cocoa removes the class in its next major. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jamescrosswell
commented
Jul 22, 2026
jamescrosswell
commented
Jul 22, 2026
jamescrosswell
commented
Jul 22, 2026
jamescrosswell
commented
Jul 22, 2026
jamescrosswell
commented
Jul 22, 2026
jamescrosswell
commented
Jul 22, 2026
Co-authored-by: James Crosswell <jamescrosswell@users.noreply.github.com>
jamescrosswell
commented
Jul 22, 2026
…entry/sentry-dotnet into migrate-private-sentrysdk-only-5331
The previous comment implied the SentryObjCCompat/SentryObjC order was a requirement. These are dynamic frameworks whose inter-dependencies are recorded in their own Mach-O load commands and resolved by dyld via @rpath at load time, so the item order has no functional effect - it's dependency-first purely for readability. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jamescrosswell
commented
Jul 22, 2026
jamescrosswell
commented
Jul 22, 2026
Co-authored-by: James Crosswell <jamescrosswell@users.noreply.github.com>
The comment's closing --> was accidentally replaced with a Unicode arrow, leaving the comment unterminated so the project file failed to load (NETSDK: "An XML comment cannot contain '--'"), which broke every CI job at environment setup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Aug 18, 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.
Migrates the iOS / Mac Catalyst hybrid-SDK bindings off the deprecated
PrivateSentrySDKOnly(static methods, slated for removal in the next sentry-cocoa major) to the structuredSentryObjCSDK.internalAPI introduced in sentry-cocoa 9.19.mainalready pins sentry-cocoa 9.22.0, so no dependency bump is required.Key incremental/separate commits, in case this helps for review purposes:
SentryObjCheaders (build-sentry-cocoa.sh, generate-cocoa-bindings.ps1, patch-cocoa-bindings.cs, ApiDefinitions.cs).PrivateSentrySDKOnlykept in parallel - e532a2fSentryCocoaHybridSdkalias to the new instance-based API cada275PrivateSentrySDKOnlyfrom the binding, patch/generate scripts, and props 55ff0b8Note: We build from source now
SentryCocoaHybridSdkMSBuild alias (SetSdkName,SetTrace,StartProfilerForTrace,CollectProfileBetween,IgnoreNextSignal). Every one has a direct equivalent within[SentryObjCSDK internal].SentryObjC-Dynamic.xcframeworkis not usable as-is. It is fully self-contained (~4.4 MB/slice): it definesSentryHubInternal,SentryClientInternal,SentryObjCSDKand the SentrySwift classes, and links no externalSentry.framework. Bundling it alongside theSentry.frameworkwe already ship would put two full copies of the SDK in the app, with split runtime state — the managed bindings would talk to one instance and the newinternalcalls to another.SentryObjCXcode scheme; it builds cleanly and ships theSentryObjCSDK/SentryObjCInternalApipublic headers.SentryObjC+SentryObjCCompatfrom source produces thin two frameworks (136 KB + 1.2 MB) that only define the new additiveSentryObjC*wrapper types and import the real SDK classes (_SentryScope,_SentryBreadcrumb,_SentryUser, …) as undefined symbols resolved at load time from the existingSentry.frameworkvia@rpath. No duplication; the new API shares the same SDK instance as the current bindings.Issues
Closes #5331