Skip to content

fix: MSB4006 circular dependency involving target "SetupCocoaSDK"#4956

Merged
Flash0ver merged 5 commits intomainfrom
cocoa-circular-dependency
Mar 16, 2026
Merged

fix: MSB4006 circular dependency involving target "SetupCocoaSDK"#4956
Flash0ver merged 5 commits intomainfrom
cocoa-circular-dependency

Conversation

@jamescrosswell
Copy link
Copy Markdown
Collaborator

@jamescrosswell jamescrosswell commented Feb 25, 2026

Resolves #4955:

Explanation

Me and Claude spent a bit of time looking at this. I think we now have a solution that is OK.

What the original code did

The recursive MSBuild call with RemoveProperties="TargetFramework" meant that during an inner build, instead of running _SetupCocoaSDK directly, it spawned a separate MSBuild process on the same project with no TargetFramework set. That separate process ran _SetupCocoaSDK once in isolation. So across both inner TFM builds, the actual work happened in one subprocess — not in the inner builds themselves.

What the new code does

_SetupCocoaSDK now runs once per inner build (once for net9.0-ios18.0, once for net9.0-maccatalyst18.0).

However, every sub-target of _SetupCocoaSDK is idempotent and has checks to make sure we're not double handling:

  • _DownloadCocoaSDK — has Condition="... And !Exists('$(SentryCocoaFramework)')", so ,skips if already downloaded
  • _BuildCocoaSDK — has Inputs/Outputs incremental build guards, skips if up-to-date
  • _GenerateSentryCocoaBindings — has Inputs/Outputs, skips if up-to-date
  • SanitizeSentryCocoaFramework — has "!Exists('$(SentryCocoaFramework).sanitized.stamp"

#skip-changelog

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 25, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.93%. Comparing base (c8c4b00) to head (a30d0d6).
⚠️ Report is 48 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4956      +/-   ##
==========================================
+ Coverage   73.89%   73.93%   +0.03%     
==========================================
  Files         496      497       +1     
  Lines       17951    17974      +23     
  Branches     3516     3517       +1     
==========================================
+ Hits        13265    13289      +24     
- Misses       3825     3826       +1     
+ Partials      861      859       -2     

☔ 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.

@jamescrosswell jamescrosswell marked this pull request as ready for review February 25, 2026 20:41
@jamescrosswell jamescrosswell requested a review from Flash0ver March 5, 2026 22:36
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Stale stamp file can skip sanitization after re-extraction
    • Deleted the sanitization stamp at the start of _DownloadCocoaSDK so any re-extracted framework is always sanitized again.

Create PR

Or push these changes by commenting:

@cursor push 584ff6f330
Preview (584ff6f330)
diff --git a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj
--- a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj
+++ b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj
@@ -62,6 +62,9 @@
 
     <Message Importance="High" Text="Setting up the Cocoa SDK version '$(SentryCocoaVersion)'." />
 
+    <!-- Ensure sanitization reruns after re-extracting an absent framework -->
+    <Delete Files="$(SentryCocoaFramework).sanitized.stamp" />
+
     <!-- Clean cache if version does not exist to get rid of old versions -->
     <RemoveDir
       Condition="!Exists('$(SentryCocoaFramework).zip')"

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

@Flash0ver Flash0ver merged commit a8a5c2d into main Mar 16, 2026
49 of 53 checks passed
@Flash0ver Flash0ver deleted the cocoa-circular-dependency branch March 16, 2026 11:27
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.

MSB4006: Circular dependency involving "SetupCocoaSDK"

2 participants