Skip to content

[net11.0] Fix R2R composite build for resource/framework name collisions and re-enable the x64 CoreLib composite root#25876

Open
kotlarmilos wants to merge 4 commits into
net11.0from
dev/fix-r2r-resource-exclude
Open

[net11.0] Fix R2R composite build for resource/framework name collisions and re-enable the x64 CoreLib composite root#25876
kotlarmilos wants to merge 4 commits into
net11.0from
dev/fix-r2r-resource-exclude

Conversation

@kotlarmilos

@kotlarmilos kotlarmilos commented Jun 30, 2026

Copy link
Copy Markdown
Member

Description

This PR improves R2R on Apple mobile in Debug.

The first fix addresses the crossgen2 failure in #25867. The _SelectR2RAssemblies target excluded user assemblies from the ReadyToRun composite by bare file name, but loose assemblies copied into resource subfolders of the app bundle, such as Uno's uno.ai.xamlgeneration.assets tooling assets, have a PublishFolderType of Resource and an empty NuGetPackageId, so they were misclassified as user assemblies and added to PublishReadyToRunExclude.

The second change re-enables the System.Private.CoreLib composite-root optimization on x64. That optimization was scoped to arm64 RuntimeIdentifiers in #25787 because it regressed x64 builds with a System.Runtime.Intrinsics.Vector256 crash, but the underlying crossgen2 issue is fixed by dotnet/runtime#129975, now backported to release/11.0-preview6, so the arm64-only restriction is removed and PublishReadyToRunCompositeRoots is applied to all RuntimeIdentifiers again.

Fixes #25867
Fixes #25734

…64 CoreLib root

Two related fixes to the Debug CoreCLR ReadyToRun composite selection in
Microsoft.Sdk.R2R.targets:

1. Fix #25867: _SelectR2RAssemblies excluded "user" assemblies from the
   composite by bare file name. Loose assemblies copied into resource
   subfolders (PublishFolderType == 'Resource', e.g. Uno tooling assets) have
   an empty NuGetPackageId and were misclassified as user assemblies, then
   added to PublishReadyToRunExclude. When such a resource copy shared a name
   with a framework/runtime-pack assembly (Microsoft.Extensions.Primitives.dll,
   which moved into the shared framework in .NET 11) the real assembly was
   wrongly excluded from the composite and crossgen2 failed with
   'Failed to load assembly' / NETSDK1096. Restrict the candidate set to
   root-of-bundle managed assemblies (PublishFolderType == 'Assembly').

2. Revert the arm64-only restriction added in #25787. The
   PublishReadyToRunCompositeRoots = System.Private.CoreLib optimization was
   scoped to arm64 because it broke x64 builds; that underlying crossgen2 issue
   is fixed by dotnet/runtime#129975, now backported to release/11.0-preview6,
   so the optimization is applied to all RuntimeIdentifiers again.

Fixes #25867

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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 Apple-specific ReadyToRun (R2R) target logic for .NET 11 to (1) avoid R2R composite input poisoning when a resource-folder DLL shares a name with a framework/runtime-pack assembly, and (2) re-enable System.Private.CoreLib as a composite root for x64 now that the upstream crossgen2 issue is fixed.

Changes:

  • Restrict the “user assembly” exclusion list to published managed assemblies (vs. resource-folder copies) to prevent filename-based collisions breaking crossgen2.
  • Re-enable the System.Private.CoreLib.dll composite-root optimization for all RIDs (not just -arm64).
Show a summary per file
File Description
dotnet/targets/Microsoft.Sdk.R2R.targets Adjusts R2R composite filtering and composite-root configuration for net11 Apple workloads.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread dotnet/targets/Microsoft.Sdk.R2R.targets Outdated
@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.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@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.

@rolfbjarne

Copy link
Copy Markdown
Member

This is still an issue on x64:

*** Terminating app due to uncaught exception 'System.NullReferenceException', reason: 'Object reference not set to an instance of an object. (System.NullReferenceException)
   at System.Runtime.Intrinsics.Vector256.get_IsHardwareAccelerated()
   at System.SpanHelpers.IndexOf(Byte& searchSpace, Int32 searchSpaceLength, Byte& value, Int32 valueLength)
   at System.Security.Cryptography.PemEncoding.IndexOfByOffset[TChar](ReadOnlySpan`1 str, ReadOnlySpan`1 value, Int32 startPosition)
   at System.Security.Cryptography.PemEncoding.TryFindCore[TChar,T](ReadOnlySpan`1 pemData, PemFields& fields)
   at System.Security.Cryptography.PemEncoding.TryFindUtf8(ReadOnlySpan`1 pemData, PemFields& fields)
   at System.Security.Cryptography.PemEnumerator`1.Enumerator.MoveNext()

@kotlarmilos

Copy link
Copy Markdown
Member Author

I think we need to wait for dotnet/runtime#129975 and rebase this PR on the latest darc flow

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@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.

@kotlarmilos

Copy link
Copy Markdown
Member Author

I think we need to wait for dotnet/runtime#129975 and rebase this PR on the latest darc flow

Sorry wrong PR - It is dotnet/runtime#129574

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

@rolfbjarne rolfbjarne enabled auto-merge (squash) July 2, 2026 05:48
@rolfbjarne rolfbjarne self-assigned this Jul 2, 2026
@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

Copy link
Copy Markdown
Collaborator

✅ [PR Build #0d3ba0e] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 0d3ba0e52ae3cfc08eea7b054f3004809ae05f5d [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #0d3ba0e] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 0d3ba0e52ae3cfc08eea7b054f3004809ae05f5d [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #0d3ba0e] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 0d3ba0e52ae3cfc08eea7b054f3004809ae05f5d [PR build]

@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: 0d3ba0e52ae3cfc08eea7b054f3004809ae05f5d [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #0d3ba0e] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

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

Failures

❌ Tests on macOS Tahoe (26) tests [attempt 2]

1 tests failed, 4 tests passed.

Failed tests

  • macOS/osx-arm64 monotouch-test: Failed (exit code 137)
    • No test failure details available. Output tail:
      • 2026-07-02 07:20:48.413 monotouchtest[83322:3432394] CFSocketSetAddress listen failure: 102
      • 2026-07-02 07:20:48.426 monotouchtest[83322:3432394] CFSocketSetAddress listen failure: 102
      • 2026-07-02 07:20:48.439 monotouchtest[83322:3432394] CFSocketSetAddress listen failure: 102
      • 2026-07-02 07:20:48.452 monotouchtest[83322:3432394] CFSocketSetAddress listen failure: 102
      • 2026-07-02 07:20:48.465 monotouchtest[83322:3432394] CFSocketSetAddress listen failure: 102
      • 2026-07-02 07:20:48.479 monotouchtest[83322:3432394] CFSocketSetAddress listen failure: 102
      • 2026-07-02 07:20:48.492 monotouchtest[83322:3432394] CFSocketSetAddress listen failure: 102
      • 2026-07-02 07:20:48.531 monotouchtest[83322:3432062] CFSocketSetAddress listen failure: 102
      • Execution timed out after 600 seconds.
      • Execution completed with exit code 137

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 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. 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 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 18 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (tvOS): All 18 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. [attempt 2] Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 0d3ba0e52ae3cfc08eea7b054f3004809ae05f5d [PR build]

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants