fix: MSB4006 circular dependency involving target "SetupCocoaSDK"#4956
fix: MSB4006 circular dependency involving target "SetupCocoaSDK"#4956
Conversation
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.
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.

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_SetupCocoaSDKdirectly, it spawned a separate MSBuild process on the same project with no TargetFramework set. That separate process ran_SetupCocoaSDKonce 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
_SetupCocoaSDKnow runs once per inner build (once fornet9.0-ios18.0, once fornet9.0-maccatalyst18.0).However, every sub-target of
_SetupCocoaSDKis 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-dateSanitizeSentryCocoaFramework— has "!Exists('$(SentryCocoaFramework).sanitized.stamp"#skip-changelog