Skip to content

[msbuild] Use GetFileSystemEntries for remote-safe XCFramework dSYM discovery - #26296

Open
rolfbjarne wants to merge 1 commit into
mainfrom
dev/rolf/urban-sniffle
Open

[msbuild] Use GetFileSystemEntries for remote-safe XCFramework dSYM discovery#26296
rolfbjarne wants to merge 1 commit into
mainfrom
dev/rolf/urban-sniffle

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

Addresses a code review comment from #26292.

Problem

The _ComputeXCFrameworkDSyms target in msbuild/Xamarin.Shared/Xamarin.Shared.targets filtered xcframework dSYM candidates using the MSBuild Exists(...) function:

<_XCFrameworkDSymToCopy
    Include="@(_XCFrameworkDSymCandidate->'%(DSymSourceDir)/%(DSymName)')"
    Condition="Exists('%(DSymSourceDir)/%(DSymName)')">
    <DSymName>%(DSymName)</DSymName>
</_XCFrameworkDSymToCopy>

Exists(...) evaluates on the MSBuild host using host path semantics. For remote builds (Windows → macOS, e.g. Hot Restart / remote Mac builds) this is wrong: the files live on the Mac, not the Windows host, so the check never finds them and the xcframework dSYMs are not copied into the archive. The old comment even claimed the target "only runs on macOS", which is misleading.

Fix

Use the existing remote-capable GetFileSystemEntries task (already used elsewhere in the same file) to discover which *.dSYM directories actually exist under the computed dSYMs directory on the build machine (the Mac), and copy only those — instead of relying on the host-side Exists(...) function.

  • The discovered directory name equals the DSymName metadata used for the copy destination, so the _XCFrameworkDSymToCopy item shape (Identity = source dSYM path, DSymName metadata) is preserved and _CopyXCFrameworkDSyms keeps working unchanged.
  • GetFileSystemEntries now skips non-existent directories, since a framework's dSYMs directory may not exist.
  • Updated the misleading "only runs on macOS" comment.

🤖 Pull request created by Copilot

…iscovery

The _ComputeXCFrameworkDSyms target filtered xcframework dSYM candidates
with the MSBuild Exists() function. Exists() evaluates on the MSBuild host,
which is wrong for remote builds (Windows -> Mac): the dSYMs live on the Mac,
not the Windows host, so the check never found them and the dSYMs were not
copied into the archive.

Use the remote-capable GetFileSystemEntries task (already used elsewhere in
this file) to discover which *.dSYM directories actually exist under the
computed dSYMs directory on the build machine, and copy only those. The
discovered directory name matches the DSymName metadata used for the copy
destination, so the _XCFrameworkDSymToCopy item shape (and _CopyXCFrameworkDSyms)
is unchanged.

Also guard GetFileSystemEntries against non-existent directories, since a
framework's dSYMs directory may not exist.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2ce0e670-fdae-4771-9cc5-68668bd95576
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the MSBuild logic that discovers and copies pre-existing XCFramework dSYM bundles so that it works correctly in remote-build scenarios (Windows MSBuild host building on a connected Mac), where MSBuild’s Exists(...) would otherwise check the wrong machine.

Changes:

  • Replaced host-evaluated Exists(...) checks with the remote-capable GetFileSystemEntries task for XCFramework *.dSYM discovery.
  • Adjusted metadata shaping so _CopyXCFrameworkDSyms continues to work with the discovered entries.
  • Hardened GetFileSystemEntries to skip missing directories instead of failing, and updated a misleading comment.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
msbuild/Xamarin.Shared/Xamarin.Shared.targets Switches XCFramework dSYM discovery from Exists(...) to GetFileSystemEntries to work correctly for remote builds.
msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntries.cs Skips non-existent input directories to avoid failures when optional directories (like dSYMs/) are missing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@rolfbjarne
rolfbjarne marked this pull request as ready for review July 27, 2026 17:28
@rolfbjarne
rolfbjarne requested a review from mauroa as a code owner July 27, 2026 17:28
@rolfbjarne rolfbjarne added the ready-to-review This PR is ready to review/merge. label Jul 27, 2026
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 963a8c3035058430291e47772ceb882905dc4773 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #963a8c3] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 203 tests passed 🎉

Tests counts

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 19 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 19 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 19 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 963a8c3035058430291e47772ceb882905dc4773 [PR build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants