Repository navigation
[release/11.0.1xx] [dotnet] Preserve parameter names in remote Windows iOS builds. Fixes #26680 - #26852
Conversation
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>
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>
There was a problem hiding this comment.
🟢 Approval recommended
The targeted backport correctly forwards the missing settings and includes focused regression coverage.
0 open findings
What changed in this PR
Preserves parameter metadata in remote Windows iOS builds by aligning the remote ILLink invocation with the .NET SDK.
Changes:
- Forwards metadata and symbol-path trimming options.
- Adds a remote Windows regression test and trimmable fixture.
| File | Description |
|---|---|
msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Common.After.targets |
Forwards omitted ILLink settings. |
tests/dotnet/UnitTests/WindowsTest.cs |
Verifies linked parameter names. |
tests/dotnet/TrimmerMetadata/Library/TrimmerMetadataLibrary.csproj |
Defines the trimmable library. |
tests/dotnet/TrimmerMetadata/Library/MetadataModel.cs |
Provides parameter metadata to inspect. |
tests/dotnet/TrimmerMetadata/iOS/TrimmerMetadata.csproj |
Defines the regression application. |
tests/dotnet/TrimmerMetadata/iOS/Program.cs |
Roots the tested members. |
🧠 Review effort: Balanced
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commitNET (empty diffs)❗ API diff vs stable (Breaking changes)NET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #62827cf] Prepare .NET Release succeeded ✅📦 Published NuGet packages (32 packages)iOS
MacCatalyst
macOS
tvOS
Other
Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #84f3445] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 269 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
Summary
Fix Debug iOS builds driven from Windows through Pair to Mac stripping parameter names from trimmed assemblies. The Windows
_RunILLinkoverride now forwardsKeepMetadata="@(_TrimmerKeepMetadata)"andPreserveSymbolPaths="$(_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.