Skip to content

[linker] Restrict globalization symbol alias to MonoVM. Fixes #26876 - #26903

Merged
rolfbjarne merged 6 commits into
mainfrom
dev/rolf/nativeaot-invariant-globalization-a44
Oct 26, 2026
Merged

rolfbjarne merged 6 commits into
mainfrom
dev/rolf/nativeaot-invariant-globalization-a44

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

ListExportedSymbols treats System.Globalization.Native as an alias for symbols provided by libmonosgen-2.0. Applying that exception to NativeAOT forces references to globalization functions even when invariant globalization omits their native library, causing undefined-symbol errors during native linking.

Limit the alias to MonoVM so NativeAOT relies on the direct references emitted by its compiler. Add invariant-globalization regression cases for all four Apple platforms with assembly preparation enabled and disabled, and document the runtime-specific symbol handling.

Fixes #26876

🤖 Pull request created by Copilot

ListExportedSymbols treats System.Globalization.Native as an alias for symbols provided by libmonosgen-2.0. Applying that exception to NativeAOT forces references to globalization functions even when invariant globalization omits their native library, causing undefined-symbol errors during native linking.

Limit the alias to MonoVM so NativeAOT relies on the direct references emitted by its compiler. Add invariant-globalization regression cases for all four Apple platforms with assembly preparation enabled and disabled, and document the runtime-specific symbol handling.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: cc0ff47f-10d6-4cea-8aa8-cb33dc13ea7b
@rolfbjarne
rolfbjarne requested a review from dalexsoto as a code owner October 16, 2026 17:59
Copilot AI balanced review requested due to automatic review settings October 16, 2026 17:59
@rolfbjarne rolfbjarne added copilot backport-to-net11.0 Add this to issues or pull requests that should be backported to .NET 11 labels Oct 16, 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.

🔵 Needs a closer look

No verified defects were identified, but Apple-platform native-link regression validation remains unconfirmed.

0 open findings

What changed in this PR

Addresses #26876 by restricting the globalization symbol alias to MonoVM, avoiding unwanted NativeAOT linker references.

Changes:

  • Applies the alias only when using MonoVM.
  • Adds invariant-globalization regression cases for all four Apple platforms, with assembly preparation enabled and disabled.
  • Documents runtime-specific symbol handling.
File Description
tools/​linker/​MonoTouch.Tuner/​ListExportedSymbols.cs Restricts the globalization alias to MonoVM.
tests/​dotnet/​UnitTests/​RuntimeConfigurationTest.cs Adds NativeAOT invariant-globalization regression coverage.
docs/​code/​native-symbols.md Explains runtime-specific globalization references.

🧠 Review effort: Balanced

@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.

@rolfbjarne

Copy link
Copy Markdown
Member Author

@github-actions

Copy link
Copy Markdown
Contributor

✅ Applied expected app size files from gist.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 06:47
@rolfbjarne rolfbjarne added the backport-to-net10.0 Add this to issues or pull requests that should be backported to .NET 10 label Oct 19, 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.

🔵 Needs a closer look

Cross-platform native-linking behavior and the revised size baseline still need CI confirmation.

No open issues 🎉

Review effort: Balanced

@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.

dalexsoto
dalexsoto previously approved these changes Oct 20, 2026
@vs-mobiletools-engineering-service2

This comment has been minimized.

Restricting the globalization symbol alias to MonoVM leaves CoreCLR apps without native API usage with no symbols to export. The Windows build creates an empty mtouch-symbols.list, but LinkNativeCode deliberately skips copying empty files to the Mac, causing the native linker to fail when opening that list.

Use the existing /dev/null export-list fallback when there are no processed native symbols. Keep real symbol lists unchanged, cover both cases with the minimal TrimmerMetadata project, and assert the empty-list behavior in the existing remote Windows regression.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: cc0ff47f-10d6-4cea-8aa8-cb33dc13ea7b
Copilot AI balanced review requested due to automatic review settings October 22, 2026 21:50
dalexsoto
dalexsoto previously approved these changes Oct 23, 2026
Copilot AI balanced review requested due to automatic review settings October 23, 2026 06:49

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 export-list assertions need property tracking enabled in both build invocations to reliably read target-time properties from the binary log.

1 open issue

Review effort: Balanced

properties ["TestReferenceNativeSymbol"] = "xamarin_release_managed_ref";

var result = DotNet.AssertBuild (project_path, properties);
Assert.That (BinLog.TryFindPropertyValue (result.BinLogPath, "_ExportedSymbolsFile", out var exportedSymbolsFile), Is.True, "Exported symbols file property");
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

⚠️ AppSizeTest expected files changed ⚠️

The AppSizeTest detected changes in the expected app size files.

To update the expected files, add a comment with the following command:

/apply-gist https://gist.github.com/vs-mobiletools-engineering-service2/909c61131782a3503a4f97001c700215
Updated files
  • TVOS-NativeAOT-size.txt

Pipeline on Agent
Hash: 9e5da4f34b8cb2f9234f866b18a5b0459c7e0175 [PR build]

dalexsoto
dalexsoto previously approved these changes Oct 23, 2026
@rolfbjarne

Copy link
Copy Markdown
Member Author

@github-actions

Copy link
Copy Markdown
Contributor

✅ Applied expected app size files from gist.

Copilot AI balanced review requested due to automatic review settings October 26, 2026 08:43

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 remote-build assertion requires property tracking that its build invocation does not enable, causing failure when tracking is disabled.

2 open issues

Review effort: Balanced

@@ -315,6 +315,8 @@ public void TrimmerKeepsParameterNamesWithRemoteMac (ApplePlatform platform, str

var result = DotNet.AssertBuild (projectPath, properties, timeout: TimeSpan.FromMinutes (15));
@vs-mobiletools-engineering-service2

This comment has been minimized.

@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: 03d5ff4f53d6495c5989650b6f1279bafc2bf772 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #03d5ff4] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 217 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 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 21 tests passed. 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: 03d5ff4f53d6495c5989650b6f1279bafc2bf772 [PR build]

@rolfbjarne
rolfbjarne merged commit 3eee4df into main Oct 26, 2026
56 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/nativeaot-invariant-globalization-a44 branch October 26, 2026 12:22
rolfbjarne added a commit that referenced this pull request Oct 28, 2026
…noVM. Fixes #26876 (#27029)

ListExportedSymbols treats System.Globalization.Native as an alias for symbols provided by libmonosgen-2.0. Applying that exception to NativeAOT forces references to globalization functions even when invariant globalization omits their native library, causing undefined-symbol errors during native linking.

Limit the alias to MonoVM so NativeAOT relies on the direct references emitted by its compiler. Add invariant-globalization regression cases for all four Apple platforms with assembly preparation enabled and disabled, and document the runtime-specific symbol handling.

Fixes #26876

🤖 Pull request created by Copilot

---------

Co-authored-by: Copilot App <[email protected]>

Backport of #26903.

---------

Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
Co-authored-by: Copilot App <[email protected]>
rolfbjarne added a commit that referenced this pull request Oct 28, 2026
…balization test

Add the tests/dotnet/TrimmerMetadata test fixture (including the TestReferenceNativeSymbol ReferenceNativeSymbol item) required by DotNetProjectTest.ExportedSymbolsFile, and include RuntimeConfigurationTest.NativeAotInvariantGlobalization from PR #26903.

Co-authored-by: Copilot App <[email protected]>
rolfbjarne added a commit that referenced this pull request Nov 13, 2026
…noVM. Fixes #26876 (#27103)

ListExportedSymbols treats System.Globalization.Native as an alias for symbols provided by libmonosgen-2.0. Applying that exception to NativeAOT forces references to globalization functions even when invariant globalization omits their native library, causing undefined-symbol errors during native linking.

Limit the alias to MonoVM so NativeAOT relies on the direct references emitted by its compiler. Add invariant-globalization regression cases for all four Apple platforms with assembly preparation enabled and disabled, and document the runtime-specific symbol handling.

Fixes #26876

🤖 Pull request created by Copilot

---------

Co-authored-by: Copilot App <[email protected]>

Backport of #26903.

---------

Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
Co-authored-by: Alex Soto <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-net10.0 Add this to issues or pull requests that should be backported to .NET 10 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.

iOS NativeAOT fails to compile when GlobalizationInvariant is set to True

4 participants