Skip to content

[net11.0] R2R-compile only System.Private.CoreLib for Debug CoreCLR mobile builds - #25583

Merged
rolfbjarne merged 6 commits into
net11.0from
dev/kotlarmilos/r2r-only-corelib-in-debug
Jun 16, 2026
Merged

[net11.0] R2R-compile only System.Private.CoreLib for Debug CoreCLR mobile builds#25583
rolfbjarne merged 6 commits into
net11.0from
dev/kotlarmilos/r2r-only-corelib-in-debug

Conversation

@kotlarmilos

@kotlarmilos kotlarmilos commented May 29, 2026

Copy link
Copy Markdown
Member

Description

In Debug builds with CoreCLR on Apple mobile, narrow _NonUserAssemblies to System.Private.CoreLib so that crossgen2 only ReadyToRun-compiles CoreLib and every other framework is excluded from R2R via the existing PublishReadyToRunExclude path. Non-R2R'd methods fall back to the interpreter at runtime. The .app bundle shrinks from 395 MB to 132 MB, with a corresponding reduction in crossgen2 time during build. Startup is unchanged in practice because the hot path through corelib is still R2R.

…obile builds

In Debug builds with CoreCLR on iOS, narrow _NonUserAssemblies to System.Private.CoreLib so that crossgen2 only ReadyToRun-compiles CoreLib and every other framework, MAUI, and NuGet assembly is excluded from R2R via the existing PublishReadyToRunExclude path. Non-R2R'd methods fall back to the CoreCLR interpreter at runtime (JIT is forbidden on iOS), which is the desired inner-loop behavior. Measured on SampleMAUI publish for ios-arm64 Debug: framework dylib drops from 318 MB to 28 MB and the .app bundle shrinks from 395 MB to 132 MB, with a corresponding reduction in crossgen2 time during build. Startup is unchanged in practice because the hot path through CoreLib is still R2R'd; only first-call cost for non-CoreLib methods shifts onto the interpreter, which is negligible for the inner-loop scenarios this default targets. Release builds are unaffected (FilterReadyToRunAssemblies already gates _SelectR2RAssemblies off for Release).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 29, 2026 14:07

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 changes Debug CoreCLR ReadyToRun filtering for macho builds so only System.Private.CoreLib is R2R-compiled, reducing Debug app size/build time while leaving other assemblies interpreted.

Changes:

  • Narrows _NonUserAssemblies to System.Private.CoreLib.
  • Routes all other assemblies through the existing PublishReadyToRunExclude path.
  • Keeps Release behavior unchanged through the existing FilterReadyToRunAssemblies gating.
Show a summary per file
File Description
dotnet/targets/Microsoft.Sdk.R2R.targets Updates the Debug CoreCLR R2R assembly selection filter to retain only CoreLib.

Copilot's findings

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

Comment thread dotnet/targets/Microsoft.Sdk.R2R.targets Outdated
Comment thread dotnet/targets/Microsoft.Sdk.R2R.targets Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rolfbjarne

Copy link
Copy Markdown
Member

/azp run

@rolfbjarne rolfbjarne self-assigned this Jun 1, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne
rolfbjarne enabled auto-merge (squash) June 2, 2026 06:02
@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

/cc: @vitek-karas @davidnguyen-tech

@rolfbjarne
rolfbjarne disabled auto-merge June 2, 2026 10:06
@rolfbjarne
rolfbjarne enabled auto-merge (squash) June 3, 2026 07:27
@rolfbjarne

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

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

@davidnguyen-tech

Copy link
Copy Markdown
Member

The composite-roots approach fixed the R2R crash — introspection, the linker jobs, and macOS tests are all green now. The two remaining failures on build 14281697 are unrelated to this change:

1. monotouch_ios — iOS Release (CoreCLR, x64): Security.SecProtocolMetadataTest.TlsDefaults

ServerName
  Expected: "www.microsoft.com"
  But was:  null

Flaky network test — it opens a real TLS connection and reads back the SNI server name, which comes back null when the agent's network hiccups. This is the Release configuration, which this PR doesn't touch (the R2R filter is Debug-only).

2. monotouch_tvos — tvOS Debug (ARM64): BuildFailure
The failing build's log ends abruptly mid-NuGet-restore and its binlog is truncated (Unable to read beyond the end of the stream) — i.e. the build process was killed (agent OOM/timeout), with no compiler or crossgen2 error anywhere. The other 23 tvOS app builds in the same job succeeded.

Both look like infra/flaky noise; a re-run of the two jobs should green the PR.

Generated by Copilot.

@rolfbjarne

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

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

Pipeline on Agent
Hash: 0b088694821e26dbefd9199ee82663c7cd61307b [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

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

Pipeline on Agent
Hash: 0b088694821e26dbefd9199ee82663c7cd61307b [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: 0b088694821e26dbefd9199ee82663c7cd61307b [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

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

Pipeline on Agent
Hash: 0b088694821e26dbefd9199ee82663c7cd61307b [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [CI Build #f33ac6b] Prepare .NET Release succeeded ✅

📦 Published NuGet packages (32 packages)

iOS

  • Microsoft.iOS.Ref.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.iOS.Runtime.ios-arm64.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.iOS.Runtime.ios.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.iOS.Runtime.iossimulator-arm64.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.iOS.Runtime.iossimulator-x64.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.iOS.Sdk.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.iOS.Templates.26.5.11545-net11-p6.nupkg
  • Microsoft.iOS.Windows.Sdk.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.NET.Sdk.iOS.Manifest-11.0.100-preview.6.26.5.11545-net11-p6.nupkg

MacCatalyst

  • Microsoft.MacCatalyst.Ref.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.MacCatalyst.Runtime.maccatalyst-arm64.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.MacCatalyst.Runtime.maccatalyst-x64.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.MacCatalyst.Runtime.maccatalyst.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.MacCatalyst.Sdk.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.MacCatalyst.Templates.26.5.11545-net11-p6.nupkg
  • Microsoft.NET.Sdk.MacCatalyst.Manifest-11.0.100-preview.6.26.5.11545-net11-p6.nupkg

macOS

  • Microsoft.macOS.Ref.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.macOS.Runtime.osx-arm64.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.macOS.Runtime.osx-x64.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.macOS.Runtime.osx.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.macOS.Sdk.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.macOS.Templates.26.5.11545-net11-p6.nupkg
  • Microsoft.NET.Sdk.macOS.Manifest-11.0.100-preview.6.26.5.11545-net11-p6.nupkg

tvOS

  • Microsoft.NET.Sdk.tvOS.Manifest-11.0.100-preview.6.26.5.11545-net11-p6.nupkg
  • Microsoft.tvOS.Ref.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.tvOS.Runtime.tvos-arm64.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.tvOS.Runtime.tvos.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.tvOS.Runtime.tvossimulator-arm64.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.tvOS.Runtime.tvossimulator-x64.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.tvOS.Sdk.net11.0_26.5.26.5.11545-net11-p6.nupkg
  • Microsoft.tvOS.Templates.26.5.11545-net11-p6.nupkg

Other

  • Sharpie.Bind.Tool.26.5.0.545-net11-p6.nupkg

Pipeline on Agent
Hash: f33ac6b30222ec69d17d5ca25954179eb6569da4 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #0b08869] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 3 tests failed, 192 tests passed.

Failures

❌ introspection tests [attempt 2]

1 tests failed, 8 tests passed.

Failed tests

  • introspection/macOS/Debug: Failed (Test run failed.
    Tests run: 34 Passed: 33 Inconclusive: 0 Failed: 1 Ignored: 0)

Html Report (VSDrops) Download

❌ Tests on macOS Sonoma (14) tests [attempt 2]

2 tests failed, 3 tests passed.

Failed tests

  • introspection: Failed (exit code 2)
    • CheckFailAttachments : System.NullReferenceException : Object reference not set to an instance of an object.
  • monotouch-test: Failed (exit code 2)
    • No test failure details available. stderr output:
      • Got a SIGABRT while executing native code. This usually indicates
      • a fatal error in the runtime or one of the native libraries
      • used by your application.
      • make[1]: *** [exec-maccatalyst-dotnet-x64-monotouch-test] Error 134
      • sed: ../.git: No such file or directory
      • fatal: not a git repository (or any of the parent directories): .git
      • fatal: not a git repository (or any of the parent directories): .git
      • ../Make.config:216: The required Xcode (26.5) is not installed in /Applications/Xcode_26.5.0.app/Contents/Developer - this directory does not exist. Any parts of the build that require Xcode will be disabled.
      • /bin/sh: ./create-make-config.sh: No such file or directory
      • make: *** [exec-monotouch-test] Error 1

Html Report (VSDrops) Download

Successes

✅ 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
✅ linker (iOS): All 11 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 24 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 27 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 24 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 Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 0b088694821e26dbefd9199ee82663c7cd61307b [PR build]

@rolfbjarne

Copy link
Copy Markdown
Member

Introspection test failures are unrelated (#25695).

@rolfbjarne
rolfbjarne merged commit 62f606e into net11.0 Jun 16, 2026
47 of 50 checks passed
@rolfbjarne
rolfbjarne deleted the dev/kotlarmilos/r2r-only-corelib-in-debug branch June 16, 2026 09:56
@rolfbjarne

Copy link
Copy Markdown
Member

Introspection test failures are unrelated (#25695).

Actually I was wrong, the introspection test failures are related (#25734).

rolfbjarne added a commit that referenced this pull request Jun 19, 2026
…oreCLR mobile builds" (#25735)

Reverts #25583, it causes a test failure: #25734.
rolfbjarne added a commit that referenced this pull request Jun 24, 2026
…rm64 builds (#25787)

Re-applies the changes from #25583 (which was reverted because it broke x64 builds), but scoped to arm64 RuntimeIdentifiers only.

The `PublishReadyToRunCompositeRoots` item is now only added when `$(RuntimeIdentifier)` ends with `-arm64`, leaving x64 builds unaffected.

🤖 Pull request created by Copilot

---------

Co-authored-by: Copilot <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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants