Skip to content

[net11.0] Make CoreCLR the default runtime.#25050

Merged
rolfbjarne merged 27 commits intonet11.0from
dev/rolf/coreclr-default
Apr 14, 2026
Merged

[net11.0] Make CoreCLR the default runtime.#25050
rolfbjarne merged 27 commits intonet11.0from
dev/rolf/coreclr-default

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

@rolfbjarne rolfbjarne commented Mar 31, 2026

Summary

Make CoreCLR the default runtime for net11.0.

This flips the default away from MonoVM and fixes the product/test fallout that showed up once that switch was made.

What changed

  • switch the default runtime selection to CoreCLR
  • build the CoreCLR extension libraries for all supported platforms
  • update bundle structure / publish logic to handle CoreCLR-specific output shapes, including multi-RID and universal app bundles
  • fix universal app bundle merging so RID-specific satellite assemblies and localized resources stay in the correct Contents/MonoBundle/<rid>/<culture>/... layout
  • improve x64 .NET macOS / Mac Catalyst test startup under Rosetta on Apple Silicon by allowing a longer launch timeout
  • update the affected tests to cover both MonoVM and CoreCLR where runtime-specific behavior is expected

Why

Changing the default runtime exposed several lingering MonoVM assumptions in our packaging and tests: bundle filtering, multi-RID publish behavior, remote Windows bundle validation, resource lookup in merged app bundles, and x64 Mac Catalyst startup timing under Rosetta.

This PR makes those paths CoreCLR-aware so that using CoreCLR by default is reliable across the supported Apple platforms.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 shared MSBuild props for Apple .NET SDK builds to make CoreCLR the default runtime by changing the default value of UseMonoRuntime.

Changes:

  • Set UseMonoRuntime to default to false when unspecified (making CoreCLR the default runtime selection).
  • Remove previous conditional defaults that set Mono as the default except for macOS / NativeAOT publishing.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Copy Markdown
Member

@dalexsoto dalexsoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@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 and others added 11 commits April 1, 2026 17:10
Update CheckAppBundleContents to accept an isCoreCLR parameter so it can
correctly filter CoreCLR-specific runtime files on all platforms (not just
macOS). This includes:

- CoreCLR/Mono dylib filtering based on isCoreCLR instead of platform
- Framework-packaged native libraries on iOS/tvOS (libcoreclr.framework, etc.)
- R2R compiled app artifacts (.r2r.dylib, BundleStructure.framework)
- libxamarin-dotnet-coreclr bridge libraries
- Per-rid assembly layout for CoreCLR on MacCatalyst multi-rid builds

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fix a typo where UseMonoRuntime was always set to 'true' regardless
of the useMonoRuntime parameter, so CoreCLR tests were never actually
testing CoreCLR.

Update assertions for CoreCLR:
- Filter out .framework/_CodeSignature entries from the 'no other
  signed app bundles' check - on iOS/tvOS, CoreCLR packages native
  runtime libraries as signed .framework bundles.
- Exclude dylibs directly in the assembly directory from the 'must be
  unsigned' check - on macOS/MacCatalyst, CoreCLR native runtime dylibs
  (libcoreclr.dylib, libSystem.*.dylib, etc.) are signed and should not
  be part of the customized code signing assertions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When CoreCLR is the default runtime, iOS/tvOS builds enable R2R
compilation (CreateR2RFramework=true, CreateR2RDylib=true). The
_CreateR2RFramework and _CreateR2RDylib targets invoke native toolchain
tasks (CompileAppManifest, LinkNativeCode) that require Xcode/Mac SDK
tools.

When IsMacEnabled=false (simulating a Windows build environment), the
Mac SDK is unavailable and _SdkVersion is empty, causing the
CompileAppManifest task to fail with a missing parameter error.

Add 'And $(IsMacEnabled) != false' to the conditions of both targets to
skip R2R framework/dylib creation when building without Mac tools.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Follow the same pattern as BundleStructureTest: split the public test
method into IsNotMacBuild_Mono and IsNotMacBuild_CoreCLR, each calling
a private IsNotMacBuild() helper that accepts a useMonoRuntime flag.

The UseInterpreter=true test case is only included in the Mono variant
since the interpreter is a MonoVM-specific feature.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CoreCLR builds link against additional native runtime libraries:
- On iOS/tvOS: @rpath/libcoreclr.framework/libcoreclr and friends,
  plus the R2R framework (@rpath/MySimpleApp.framework/MySimpleApp)
- On macOS/MacCatalyst: @executable_path/.../libcoreclr.dylib and friends,
  plus the R2R dylib (MySimpleApp.r2r.dylib)

CoreCLR None builds are also missing CryptoKit compared to MonoVM,
since CoreCLR's BCL doesn't reference it.

macOS is CoreCLR-only (no Mono variant), so it's only in _CoreCLR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extract shared coreclrFrameworks_iOS/tvOS/MacCatalyst arrays with the
CoreCLR runtime library entries. Rename the _Mono base arrays to have no
suffix (common to both runtimes), then build the _Mono and _CoreCLR
variants using spread expressions:

  _None_Mono = [.. base_None, CryptoKit]
  _None_CoreCLR = [.. coreclrFrameworks, .. base_None]
  _Full_Mono = base_Full (alias)
  _Full_CoreCLR = [.. coreclrFrameworks, .. base_Full]

This removes ~530 lines of duplicated framework lists.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Makes future diffs easier to read when frameworks are added or removed.

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

This comment has been minimized.

Copy link
Copy Markdown
Member

@dalexsoto dalexsoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀🚀

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

rolfbjarne and others added 3 commits April 3, 2026 09:54
…CoreCLR test variants

The R2R framework properties (_R2RFrameworkName, _R2RFrameworkPath, etc.)
were declared inside the _PrepareR2RFrameworkCreation target, so they were
only available after that target ran. In multi-RID outer builds
(RuntimeIdentifiers=ios-arm64), _PrepareR2RFrameworkCreation never executes
because CreateReadyToRunImages dispatches to inner builds. This left
_R2RFrameworkName empty in the outer build context.

_CollectR2RFrameworksForPostProcessing uses _R2RFrameworkName to populate
the post-processing item list for dsymutil/strip. With an empty name it
produced a path like 'Frameworks/.framework/', causing dsymutil to fail:
'cannot parse the debug map: No such file or directory'.

Fix: move all R2R framework PropertyGroup declarations to a static
PropertyGroup outside any target in Microsoft.Sdk.R2R.targets.
DeviceSpecificIntermediateOutputPath is stable at evaluation time (set in
Xamarin.Shared.props and not overridden in the .NET SDK targets), and
AssemblyName is always available, so all derived properties are computed
correctly in both inner builds and multi-RID outer builds.

Also split PluralRuntimeIdentifiers and PluralRuntimeIdentifiersWithRemoteMac
into _Mono and _CoreCLR test variants so both runtimes are covered explicitly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
With CoreCLR, C# changes don't trigger native re-linking because R2R
output is a separate framework (not an input to _LinkNativeExecutable).
This is different from MonoVM behavior where AOT .o files are linked
into the native executable.

Split CodeChangeSkipsTargets and CodeChangeSkipsTargetsOnRemoteWindows
into _Mono and _CoreCLR variants to handle this difference.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
With CoreCLR (R2R), assemblies retain their IL bodies — they are not
stripped the way MonoVM AOT strips method bodies. Split BuildIpaTest
into _Mono and _CoreCLR variants and pass shouldStrip accordingly.

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.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne marked this pull request as ready for review April 13, 2026 08:19
@rolfbjarne rolfbjarne requested a review from mauroa as a code owner April 13, 2026 08:19
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
2 pipeline(s) require an authorized user to comment /azp run to run.

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
2 pipeline(s) require an authorized user to comment /azp run to run.

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

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
2 pipeline(s) require an authorized user to comment /azp run to run.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #7aef15b] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 7aef15b190b665bdc79ab730a43f27e547f3f549 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #7aef15b] Build passed (Detect API changes) ✅

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

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #7aef15b] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 7aef15b190b665bdc79ab730a43f27e547f3f549 [PR build]

@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

🚀 [CI Build #7aef15b] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 161 tests passed 🎉

Tests counts

✅ 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 9 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 19 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 15 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

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 7aef15b190b665bdc79ab730a43f27e547f3f549 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne merged commit bd42ed4 into net11.0 Apr 14, 2026
46 checks passed
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.

5 participants