Skip to content

[registrar] Preserve platform assembly with partial-static. Fixes #27610 - #27613

Open
rolfbjarne wants to merge 8 commits into
mainfrom
dev/rolf/fix-partial-static-frameworks
Open

rolfbjarne wants to merge 8 commits into
mainfrom
dev/rolf/fix-partial-static-frameworks

Conversation

@rolfbjarne

@rolfbjarne rolfbjarne commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 4ff6177ed7a1388e206907ec00312ac1f3cc38ca

Dimension Assessment Rationale
Change confidence 8.5/10 ↑ Seven iOS and Mac Catalyst trimming cases pass, including aliases and options.
↑ Default-registrar cases pass on installed platforms.
↓ iOS device execution remains unverified.
Diagnosis confidence 9/10 ↑ The prebuilt registrar depends on platform assembly metadata that trimming changes.
Evidence fit 8.5/10 ↑ The reported link failure disappears when trimming is disabled.
↓ The original app was not rerun.

This preserves the platform assembly when using the partial-static registrar, so its original metadata tokens remain valid while other assemblies can still be trimmed. It emits warning MT7203 when trimming has to be disabled for the platform assembly, and documents the behavior. Regression coverage verifies the platform assembly stays byte-identical, its MVID is present in the native executable, and registrar validation succeeds.

Fixes #27610
🤖 Pull request created by Copilot

rolfbjarne and others added 6 commits December 3, 2026 14:16
The prebuilt registrar refers to metadata tokens from the original platform assembly. Copy that assembly unchanged when using partial-static so its registrar remains valid and framework references are retained.

Fixes #27610

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Warn when the partial-static registrar overrides platform assembly trimming, and use ApiTestApp for the regression cases.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@rolfbjarne
rolfbjarne requested a review from dalexsoto as a code owner December 3, 2026 13:26
Copilot AI balanced review requested due to automatic review settings December 3, 2026 13:26

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.

🟡 Changes recommended

The registrar condition omits accepted partial-static aliases, allowing trimming to retain the prebuilt archive and leaving the linker/token-compatibility failure unresolved.

1 open issue
What changed in this PR

Preserves the Apple platform assembly for the partial-static registrar, addressing #27610 while allowing other assemblies to be trimmed.

Changes:

  • Forces platform-assembly copying and adds warning MT7203.
  • Adds trimming annotations and targeted warning suppressions.
  • Documents the behavior and adds iOS/Mac Catalyst regression coverage.
File Description
tests/​dotnet/​UnitTests/​RegistrarTest.cs Checks assembly preservation and registrar compatibility.
src/​ObjCRuntime/​TypeConverter.cs Annotates reflection-dependent conversions.
src/​ObjCRuntime/​Runtime.cs Updates trimming annotations and suppressions.
src/​ObjCRuntime/​RequiresSuperAttribute.cs Suppresses a tooling-related trimming warning.
src/​ObjCRuntime/​DynamicRegistrar.cs Suppresses a configuration-dependent warning.
src/​ObjCRuntime/​Blocks.cs Limits suppression to applicable platforms.
src/​Foundation/​NSCoder.cs Annotates reflection-dependent decoding.
msbuild/​Xamarin.MacDev.Tasks/​Tasks/​MacDevMessage.cs Supports numbered diagnostics.
msbuild/​Xamarin.Localization.MSBuild/​MSBStrings.resx Adds localized MT7203 text.
dotnet/​targets/​Xamarin.Shared.Sdk.targets Preserves the platform assembly and emits MT7203.
docs/​website/​mtouch-errors.md Documents MT7203.
docs/​building-apps/​build-properties.md Explains partial-static trimming behavior.

Review effort: Balanced

@MauiBot

MauiBot commented Dec 3, 2026

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: b6f45fa5f584313227176dee5d425d9195125c68 [PR build]

@MauiBot

MauiBot commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #b6f45fa] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

1 tests crashed, 0 tests failed, 143 tests passed.

Failures

❌ msbuild tests

🔥 Failed catastrophically on VSTS: test results - msbuild (no summary found).

Html Report (VSDrops) Download

Successes

✅ 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 1 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 12 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 12 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 12 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 11 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: b6f45fa5f584313227176dee5d425d9195125c68 [PR build]

rolfbjarne and others added 2 commits December 4, 2026 11:26
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 4, 2026 11:13

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.

🟡 Changes recommended

Platform-assembly rewriting can invalidate prebuilt registrar metadata tokens in the Release/partial-static/strict configuration, and the new warning incorrectly reuses the existing MT7203 diagnostic number.

2 open issues
1 resolved since last review

Review effort: Balanced

Update="@(ResolvedFileToPublish)"
Condition="'$(_RegistrarMode)' == 'partial-static' And '%(ResolvedFileToPublish.Filename)' == '$(_PlatformAssemblyName)' And '%(ResolvedFileToPublish.Extension)' == '.dll'"
>
<TrimMode>copy</TrimMode>
<!-- The partial-static registrar contains metadata tokens from the original platform assembly, so disable trimming for the platform assembly when using the partial-static registrar. -->
<MacDevMessage
Condition="'$(_RegistrarMode)' == 'partial-static' And '$(PublishTrimmed)' == 'true' And '%(ResolvedFileToPublish.Filename)' == '$(_PlatformAssemblyName)' And '%(ResolvedFileToPublish.Extension)' == '.dll' And '%(ResolvedFileToPublish.TrimMode)' != 'copy' And ('%(ResolvedFileToPublish.TrimMode)' != '' Or '$(TrimMode)' != 'copy')"
Code="7203"
@MauiBot

MauiBot commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

🔥 Unable to find the contents for the comment: D:\a\1\s\change-detection\results\gh-comment.md does not exist :fire

Pipeline on Agent
Hash: [PR build]

@MauiBot

MauiBot commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #4ff6177] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

29 tests crashed, 0 tests failed, 0 tests passed.

Failures

❌ assembly-processing tests

🔥 Failed catastrophically on VSTS: test results - assembly-processing (no summary found).

Html Report (VSDrops) Download

❌ cecil tests

🔥 Failed catastrophically on VSTS: test results - cecil (no summary found).

Html Report (VSDrops) Download

❌ dotnettests tests (iOS)

🔥 Failed catastrophically on VSTS: test results - dotnettests_ios (no summary found).

Html Report (VSDrops) Download

❌ dotnettests tests (MacCatalyst)

🔥 Failed catastrophically on VSTS: test results - dotnettests_maccatalyst (no summary found).

Html Report (VSDrops) Download

❌ dotnettests tests (macOS)

🔥 Failed catastrophically on VSTS: test results - dotnettests_macos (no summary found).

Html Report (VSDrops) Download

❌ dotnettests tests (Multiple platforms)

🔥 Failed catastrophically on VSTS: test results - dotnettests_multiple (no summary found).

Html Report (VSDrops) Download

❌ dotnettests tests (tvOS)

🔥 Failed catastrophically on VSTS: test results - dotnettests_tvos (no summary found).

Html Report (VSDrops) Download

❌ framework tests

🔥 Failed catastrophically on VSTS: test results - framework (no summary found).

Html Report (VSDrops) Download

❌ fsharp tests

🔥 Failed catastrophically on VSTS: test results - fsharp (no summary found).

Html Report (VSDrops) Download

❌ generator tests

🔥 Failed catastrophically on VSTS: test results - generator (no summary found).

Html Report (VSDrops) Download

❌ interdependent-binding-projects tests

🔥 Failed catastrophically on VSTS: test results - interdependent-binding-projects (no summary found).

Html Report (VSDrops) Download

❌ introspection tests

🔥 Failed catastrophically on VSTS: test results - introspection (no summary found).

Html Report (VSDrops) Download

❌ linker tests (iOS)

🔥 Failed catastrophically on VSTS: test results - linker_ios (no summary found).

Html Report (VSDrops) Download

❌ linker tests (MacCatalyst)

🔥 Failed catastrophically on VSTS: test results - linker_maccatalyst (no summary found).

Html Report (VSDrops) Download

❌ linker tests (macOS)

🔥 Failed catastrophically on VSTS: test results - linker_macos (no summary found).

Html Report (VSDrops) Download

❌ linker tests (tvOS)

🔥 Failed catastrophically on VSTS: test results - linker_tvos (no summary found).

Html Report (VSDrops) Download

❌ monotouch tests (iOS)

🔥 Failed catastrophically on VSTS: test results - monotouch_ios (no summary found).

Html Report (VSDrops) Download

❌ monotouch tests (MacCatalyst)

🔥 Failed catastrophically on VSTS: test results - monotouch_maccatalyst (no summary found).

Html Report (VSDrops) Download

❌ monotouch tests (macOS)

🔥 Failed catastrophically on VSTS: test results - monotouch_macos (no summary found).

Html Report (VSDrops) Download

❌ monotouch tests (tvOS)

🔥 Failed catastrophically on VSTS: test results - monotouch_tvos (no summary found).

Html Report (VSDrops) Download

❌ msbuild tests

🔥 Failed catastrophically on VSTS: test results - msbuild (no summary found).

Html Report (VSDrops) Download

❌ sharpie tests

🔥 Failed catastrophically on VSTS: test results - sharpie (no summary found).

Html Report (VSDrops) Download

❌ windows tests

🔥 Failed catastrophically on VSTS: test results - windows (no summary found).

Html Report (VSDrops) Download

❌ xcframework tests

🔥 Failed catastrophically on VSTS: test results - xcframework (no summary found).

Html Report (VSDrops) Download

❌ xtro tests

🔥 Failed catastrophically on VSTS: test results - xtro (no summary found).

Html Report (VSDrops) Download

❌ Tests on macOS Sonoma (14) tests

⚠️ Tests did not run because the Build macOS tests job failed.

Html Report (VSDrops) Download

❌ Tests on macOS Sequoia (15) tests

⚠️ Tests did not run because the Build macOS tests job failed.

Html Report (VSDrops) Download

❌ Tests on macOS Tahoe (26) tests

⚠️ Tests did not run because the Build macOS tests job failed.

Html Report (VSDrops) Download

❌ Tests on macOS Golden Gate (27) tests

⚠️ Tests did not run because the Build macOS tests job failed.

Html Report (VSDrops) Download

Successes

macOS tests

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: 4ff6177ed7a1388e206907ec00312ac1f3cc38ca [PR build]

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS device build with Registrar=partial-static (CoreCLR) fails to link: _OBJC_CLASS_$_CIFilter undefined

3 participants