Skip to content

[CoreCLR] support MAUI full ReadyToRun - #12299

Merged
jonathanpeppers merged 4 commits into
mainfrom
jonathanpeppers-document-full-r2r
Aug 5, 2026
Merged

[CoreCLR] support MAUI full ReadyToRun#12299
jonathanpeppers merged 4 commits into
mainfrom
jonathanpeppers-document-full-r2r

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Aug 4, 2026

Copy link
Copy Markdown
Member

.NET MAUI uses partial ReadyToRun with default MIBC profiles for Android
CoreCLR Release builds. The companion MAUI change adds
$(MauiEnableFullReadyToRun) and, when enabled, omits the partial
compilation switch and those profiles.

Honor that opt-in in .NET for Android by preventing the generated
main-assembly MIBC profile from being added to the ReadyToRun inputs.
The property is checked directly in the target condition so its value
from MAUI's buildTransitive targets is observed at execution time.

Expand the build-property reference to document:

  • $(PublishReadyToRun), including its Android CoreCLR Release
    default and size/startup tradeoffs.
  • $(PublishReadyToRunComposite), which defaults to true when
    ReadyToRun is enabled.
  • $(UseMonoRuntime), which selects Mono instead of CoreCLR.
  • $(RunAOTCompilation) as Mono-specific AOT compilation.
  • $(MauiEnableFullReadyToRun), including its partial/full behavior
    and size/performance tradeoffs.

The documentation links to the .NET MAUI runtimes and compilation
guide for broader runtime and compilation context.

Issue: dotnet/maui#36587

Companion MAUI PR: dotnet/maui#37094


  • Useful description of why the change is necessary.
  • Links to issues fixed
  • Unit tests

.NET MAUI normally uses partial ReadyToRun with MIBC profiles on
Android CoreCLR Release builds.  Its new
`$(MauiEnableFullReadyToRun)` opt-in removes the partial compilation
switch and default profiles.

Do not add the generated main-assembly MIBC profile when that opt-in is
enabled, so the Android build preserves MAUI's full ReadyToRun request.
Document the property and its application-size and performance
tradeoffs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 85e3ea0b-f415-4971-b5b9-55dde11e943e

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

Adds an opt-in hook for .NET MAUI CoreCLR Android apps to switch from MAUI’s default partial ReadyToRun setup (with MIBC profiles) to full ReadyToRun, and documents the new property and its tradeoffs.

Changes:

  • Updates CoreCLR ReadyToRun MSBuild logic to skip generating/adding the app main-assembly MIBC profile when $(MauiEnableFullReadyToRun) is enabled.
  • Updates build properties documentation to describe MauiEnableFullReadyToRun behavior and size/perf implications.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.CoreCLR.targets Adds an execution-time condition to suppress main-assembly MIBC profile generation when MAUI opts into full ReadyToRun.
Documentation/docs-mobile/building-apps/build-properties.md Documents the new MauiEnableFullReadyToRun property and its tradeoffs.

Comment thread Documentation/docs-mobile/building-apps/build-properties.md Outdated
Keep `$(MauiEnableFullReadyToRun)` after `$(MandroidI18n)` in the
alphabetically sorted build-properties documentation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 85e3ea0b-f415-4971-b5b9-55dde11e943e
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Aug 4, 2026
jonathanpeppers and others added 2 commits August 5, 2026 08:50
Document the `$(PublishReadyToRun)` and
`$(PublishReadyToRunComposite)` defaults used by Android CoreCLR
Release builds.  Explain how `$(UseMonoRuntime)` selects between Mono
and CoreCLR, and clarify that `$(RunAOTCompilation)` is specific to
Mono AOT.

Expand the `$(MauiEnableFullReadyToRun)` guidance and link to the .NET
MAUI runtime and compilation overview for broader context.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 85e3ea0b-f415-4971-b5b9-55dde11e943e
Document that `$(UseMonoRuntime)` defaults to Mono through .NET 10 and
to CoreCLR starting in .NET 11.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 85e3ea0b-f415-4971-b5b9-55dde11e943e
@jonathanpeppers
jonathanpeppers enabled auto-merge (squash) August 5, 2026 19:36

This MSBuild property is obsolete and is no longer supported.

## MauiEnableFullReadyToRun

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as on the MAUI PR:

"MauiEnableFullReadyToRun" sounds a bit clunky, and --partial isn't really specific to Maui anyway.

Maybe a better option would be to introduce a PublishReadyToRunPartial property, which adds --partial to PublishReadyToRunCrossgen2ExtraArgs when true (in dotnet/sdk), and which Android can set to false by default? And then users can do PublishReadyToRunPartial=false to get the full R2R experience.

Either way this is good to me, so I'll approve. FWIW I looked into if we need to do something similar in dotnet/macios, and the answer is no, because we do full R2R by default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we want to make this MAUI specific for now, since MAUI is right now the only scenario which injects default profile (so the --partial actually does something on its own). The more generic PublichReadyToRunPartial would need to go to SDK (to be correct) and on its own would not function - if we wanted to add this functionality to SDK property, a better design would be to pair it with another property/item group which actually specifies the profiles.

But I'm open to better names (as always, naming is the hardest part).

@jonathanpeppers
jonathanpeppers merged commit 47cb664 into main Aug 5, 2026
44 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-document-full-r2r branch August 5, 2026 19:41
kubaflo pushed a commit to dotnet/maui that referenced this pull request Aug 8, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Description

Adds the `MauiEnableFullReadyToRun` MSBuild property for .NET MAUI
Android CoreCLR Release builds.

Setting the property to `true` opts into full ReadyToRun compilation by
omitting MAUI's `--partial` Crossgen2 argument and default MIBC
profiles. Leaving it unset or setting it to `false` preserves the
existing partial ReadyToRun behavior.

Includes workload-neutral MSBuild coverage for the unset, `false`, and
`true` cases.

Companion PR: dotnet/android#12299 documents the property and excludes
the generated main-assembly MIBC profile when full ReadyToRun is
enabled.

Closes #36587

Copilot-Session: 14d40ad5-6e1e-4491-9965-c95cc93958fe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants