Skip to content

[dotnet] Preserve parameter names in remote Windows iOS builds. Fixes #26680 - #26693

Merged
rolfbjarne merged 6 commits into
mainfrom
dev/rolf/remote-windows-trimmer-metadata
Oct 5, 2026
Merged

rolfbjarne merged 6 commits into
mainfrom
dev/rolf/remote-windows-trimmer-metadata

Conversation

@rolfbjarne

@rolfbjarne rolfbjarne commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Fix Debug iOS builds driven from Windows through Pair to Mac stripping parameter names from trimmed assemblies. The Windows _RunILLink override now forwards KeepMetadata="@(_TrimmerKeepMetadata)" and PreserveSymbolPaths="$(_TrimmerPreserveSymbolPaths)" to the remote ILLink task, matching the .NET SDK target used by Mac-driven builds. This preserves parameter metadata needed by reflection-based consumers without changing the SDK's trimming policy.

Add a remote Windows regression test that builds an iOS app referencing a trimmable library, then inspects the linked library copied back from the Mac and checks its constructor and method parameter names.

Validation

The regression test first failed in Windows Pair-to-Mac CI on the missing constructor parameter names. After the fix, the Windows Integration Tests Dotnet tests job passed in build 15487813. The Windows MSBuild task project built locally with no warnings or errors; the remote-only test is discovered but skips on macOS. A newer CI run is pending.

Fixes #26680

🤖 Pull request created by Copilot

rolfbjarne and others added 4 commits September 23, 2026 18:11
Build a Debug iOS app from Windows with a trimmable library and inspect the linked assembly copied back from the Mac. Assert that constructor and method parameter names remain intact, matching the .NET SDK's debugger-friendly trimming behavior. Leave the Windows ILLink target unchanged so CI can demonstrate the regression before the fix.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
WindowsTest already imports System.Reflection.Metadata, which also defines AssemblyDefinition. Qualify the Cecil type used to inspect the linked fixture assembly so the regression test compiles without changing either existing namespace import.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Handle a missing linked model explicitly so the test reports its assertion failure before inspecting methods. This also keeps the remote regression test aligned with the repository's nullable code conventions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The regression inspects linked parameter names directly, so the app only needs to root its constructor and method. Avoid reflection-based JSON serialization warnings that could fail the remote build before the intended metadata assertion runs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Forward the SDK's KeepMetadata items and PreserveSymbolPaths setting to the remote ILLink task. Debug builds now retain parameter names in trimmed assemblies when driven from Windows, matching builds driven directly from the Mac; deterministic source path handling also stays consistent with the SDK target. The previously committed Pair-to-Mac regression test observed the missing constructor names on Windows CI before this fix.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne
rolfbjarne marked this pull request as ready for review September 29, 2026 06:28
Copilot AI balanced review requested due to automatic review settings September 29, 2026 06:28
@rolfbjarne rolfbjarne added the backport-to-net11.0 Add this to issues or pull requests that should be backported to .NET 11 label Sep 29, 2026

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.

Copilot review overview

🟡 Changes recommended

Symbol-path preservation lacks regression coverage, and the PR description contradicts the implemented scope.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Fixes metadata loss in remote Windows iOS builds and adds regression coverage.

Changes:

  • Forwards linker metadata and symbol-path settings.
  • Adds a trimmable fixture and remote Windows parameter-name test.
File Description
WindowsTest.cs Validates preserved parameter names.
TrimmerMetadataLibrary.csproj Defines trimmable library.
MetadataModel.cs Supplies parameter metadata.
TrimmerMetadata.csproj Defines iOS test app.
Program.cs Roots tested members.
Xamarin.iOS.Common.After.targets Forwards omitted linker settings.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copilot AI balanced review requested due to automatic review settings September 30, 2026 20:23

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.

Copilot review overview

🟢 Approval recommended

The parameter-metadata fix is correct and regression-tested; only non-blocking symbol-path coverage remains.

Review effort: Balanced
Findings: None

Resolved since last review (2)

@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: 816e54cff4e11c01a7b322dfd5ebab4fead01400 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #816e54c] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 221 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 21 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 21 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 20 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 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
✅ Tests on macOS Golden Gate (27): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: 816e54cff4e11c01a7b322dfd5ebab4fead01400 [PR build]

@rolfbjarne rolfbjarne added the ready-to-review This PR is ready to review/merge. label Oct 1, 2026
@rolfbjarne
rolfbjarne enabled auto-merge (squash) October 1, 2026 07:36
@rolfbjarne
rolfbjarne merged commit 9426b27 into main Oct 5, 2026
56 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/remote-windows-trimmer-metadata branch October 5, 2026 19:26
rolfbjarne added a commit that referenced this pull request Oct 14, 2026
…s iOS builds. Fixes #26680 (#26852)

## Summary

Fix Debug iOS builds driven from Windows through Pair to Mac stripping parameter names from trimmed assemblies. The Windows `_RunILLink` override now forwards `KeepMetadata="@(_TrimmerKeepMetadata)"` and `PreserveSymbolPaths="$(_TrimmerPreserveSymbolPaths)"` to the remote ILLink task, matching the .NET SDK target used by Mac-driven builds. This preserves parameter metadata needed by reflection-based consumers without changing the SDK's trimming policy.

Add a remote Windows regression test that builds an iOS app referencing a trimmable library, then inspects the linked library copied back from the Mac and checks its constructor and method parameter names.

Fixes #26680

🤖 Pull request created by Copilot

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Rolf Bjarne Kvinge <rokvin@microsoft.com>

Backport of #26693.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-net11.0 Add this to issues or pull requests that should be backported to .NET 11 copilot ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows (Pair to Mac) builds strip parameter names: _RunILLink override omits KeepMetadata

5 participants