Skip to content

Conversation

jpnurmi
Copy link
Collaborator

@jpnurmi jpnurmi commented Sep 22, 2025

Motivation

  1. Local development: To make it easier to develop locally against an unreleased version of the Sentry Cocoa SDK without reverting d179ec9 as done in WIP: Prevent Cocoa SDK from capturing errors that also get captured by .NET #4537
  2. Integration testing: To be able to implement an integration test for [WIP] fix: interop with managed .NET runtimes sentry-cocoa#6193, Sentry .NET would need to be able to run against an unreleased version of the Sentry Cocoa SDK
  3. C# binding updates: To allow easier experimenting with C# bindings ahead of time for unreleased Sentry Cocoa SDK versions. Due to the ongoing efforts to convert Obj-C types to Swift, it would be nice to be able to test the impact on the C# bindings.

Instructions

To switch to local development mode, replace the pre-built Sentry Cocoa SDK in modules/sentry-cocoa with a clone of getsentry/sentry-cocoa:

$ rm -rf modules/sentry-cocoa
$ gh repo clone getsentry/sentry-cocoa modules/sentry-cocoa
$ dotnet build ...

To switch back to a pre-built Sentry Cocoa SDK, delete the modules/sentry-cocoa clone and let Sentry.Bindings.Cocoa.csproj download the version declared in modules/sentry-cocoa.properties:

$ rm -rf modules/sentry-cocoa
$ dotnet build ...

#skip-changelog (for internal development purposes only)


Note

Enable using a local modules/sentry-cocoa clone by choosing between downloading prebuilt SDK or building from source, updating bindings generation and docs.

  • Build system (Sentry.Bindings.Cocoa)
    • Add conditional local checkout support: use modules/sentry-cocoa/.git to switch between prebuilt xcframework and source build (Carthage/Build-*/Sentry.xcframework).
    • New targets: _DownloadCocoaSDK (prebuilt), _BuildCocoaSDK (runs scripts/build-sentry-cocoa.sh), combined in _SetupCocoaSDK and invoked unconditionally on macOS.
    • Override properties for local builds and unify binding inputs via SentryCocoaBindingInputs.
  • Scripts
    • scripts/build-sentry-cocoa.sh: copy headers from ios-arm64_arm64e; write build marker from .git/HEAD to Carthage/.built-from-sha.
    • scripts/generate-cocoa-bindings.ps1: support both local clone (use Carthage/Headers) and downloaded framework paths; update header patching and sharpie inputs accordingly.
  • Docs
    • CONTRIBUTING.md: add instructions for switching between prebuilt SDK and local getsentry/sentry-cocoa clone in modules/sentry-cocoa.

Written by Cursor Bugbot for commit 59da77d. This will update automatically on new commits. Configure here.

Copy link

codecov bot commented Sep 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.46%. Comparing base (58b5da0) to head (9c7a198).
⚠️ Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4551      +/-   ##
==========================================
+ Coverage   73.37%   73.46%   +0.09%     
==========================================
  Files         479      482       +3     
  Lines       17505    17678     +173     
  Branches     3445     3493      +48     
==========================================
+ Hits        12844    12988     +144     
- Misses       3783     3800      +17     
- Partials      878      890      +12     

☔ View full report in Codecov by Sentry.
📢 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.

To allow rebuilding sentry-cocoa in local development mode when a
locally built .xcframework already exists.
@Flash0ver
Copy link
Member

cool ... I'm wondering if it could help to add a section with these instructions to CONTRIBUTING.md ... or if there is another location to keep them to make them "discoverable" later on

@jpnurmi jpnurmi marked this pull request as ready for review September 23, 2025 11:51
@jpnurmi
Copy link
Collaborator Author

jpnurmi commented Sep 23, 2025

I'd propose adding the instructions to modules/README.md right next to modules/sentry-cocoa.properties. Let me know if you prefer CONTRIBUTIONS.md instead. :)

cursor[bot]

This comment was marked as outdated.

Copy link
Member

@Flash0ver Flash0ver left a comment

Choose a reason for hiding this comment

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

Nice! I got a bunch of questions:

Fork [getsentry/perfview](https://github.com/getsentry/perfview/).
Tool from the .NET team which includes several utilities used for profiling .NET code.
We use that in our `Sentry.Profiling` package.

Copy link
Member

Choose a reason for hiding this comment

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

I believe we also miss an entry for sentry-native ... but that's not part of this changeset ... I can follow-up on that afterwards.

@Flash0ver
Copy link
Member

@jpnurmi
Copy link
Collaborator Author

jpnurmi commented Sep 25, 2025

Hey @jamescrosswell, are you ok with this minor complication of the build system? It's not something one needs for normal .NET development tasks, but it comes in very handy when working on the Cocoa SDK integration.

cursor[bot]

This comment was marked as outdated.

@jamescrosswell
Copy link
Collaborator

Hey @jamescrosswell, are you ok with this minor complication of the build system? It's not something one needs for normal .NET development tasks, but it comes in very handy when working on the Cocoa SDK integration.

Yep, all good - sounds like a nice compromise 👍🏻

Copy link
Collaborator

@jamescrosswell jamescrosswell left a comment

Choose a reason for hiding this comment

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

Looks good - just one minor comment about arm64e.

@jpnurmi jpnurmi merged commit 93a6689 into main Oct 2, 2025
50 of 51 checks passed
@jpnurmi jpnurmi deleted the jpnurmi/local-sentry-cocoa branch October 2, 2025 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants