Skip to content

[Android] Add full ReadyToRun opt-in - #37094

Merged
kubaflo merged 1 commit into
net11.0from
jonathanpeppers-enable-android-full-r2r
Aug 8, 2026
Merged

kubaflo merged 1 commit into
net11.0from
jonathanpeppers-enable-android-full-r2r

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

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

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

Copilot-Session: 14d40ad5-6e1e-4491-9965-c95cc93958fe
Copilot AI review requested due to automatic review settings August 4, 2026 17:49
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37094

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37094"

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

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 a new MSBuild opt-in (MauiEnableFullReadyToRun) to switch .NET MAUI Android CoreCLR Release builds from the current default “partial ReadyToRun + default MAUI MIBC profiles” behavior to “full ReadyToRun without default MAUI MIBC profiles”.

Changes:

  • Update Microsoft.Maui.Controls.targets to apply --partial Crossgen2 args and default MIBC profiles only when MauiEnableFullReadyToRun is not true.
  • Extend MSBuild unit test infrastructure to allow running dotnet msbuild.
  • Add MSBuild coverage validating the property’s unset / false / true behaviors.

Reviewed changes

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

File Description
src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs Adds a dotnet msbuild option to the test build helper and introduces a theory validating MauiEnableFullReadyToRun behavior for partial/full R2R and default MIBC inclusion.
src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targets Gates MAUI’s default partial-R2R args and default ReadyToRun PGO (MIBC) profile inclusion on MauiEnableFullReadyToRun != true.

jonathanpeppers added a commit to dotnet/android that referenced this pull request Aug 5, 2026
.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

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

kubaflo commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Empirical validation: merge-ready after one housekeeping item

I independently reviewed and tested this change and found no code or behavioral blocker. GitHub currently reports BLOCKED because one answered review thread is still unresolved; once that thread is marked resolved, I consider this good to merge.

What I tested

  • Current potential merge deff58171972 (PR head a56f5243b124 merged into net11.0 at addb8e1bf0f6)
  • .NET SDK 11.0.100-preview.7.26381.103
  • Android 13 / API 33 arm64 emulator, CoreCLR, Release, composite ReadyToRun
  • Real AAB/APK builds, installation, launch, and two repeated Appium-driven compute/async UI interactions
  • Binlog comparison of the default and opt-in builds
Case Evaluated build behavior Runtime result
Base b6bcbff49962 + MauiEnableFullReadyToRun=true Still partial; --partial present Launched; both interactions passed
Current merge + property unset Partial; --partial present; 6 MAUI MIBC inputs Launched; both interactions passed
Current merge + property true Full; --partial absent; 0 MAUI/generated MIBC inputs Launched; both interactions passed

The binlog diff shows the intended switch precisely:

MauiEnableFullReadyToRun:                 '' -> 'true'
PublishReadyToRunCrossgen2ExtraArgs: ';--partial' -> ''
_MauiUseDefaultReadyToRunPgoFiles:    'true' -> ''

The expected size tradeoff is visible too:

  • AAB: 21,782,876 -> 29,689,996 bytes (+36.3%)
  • APK: 22,548,119 -> 30,457,495 bytes (+35.1%)

Official CI is green: maui-pr build 1539700 passed all 26 jobs, Build Analysis passed, and the Windows Controls.Xaml Helix work item exited successfully.

The installed Android pack (37.0.0-ci.main.2139) predates the already-merged dotnet/android#12299, so this run validates the MAUI side against the currently pinned pack. In the tested default path, no generated main-assembly MIBC was present.

Screenshots

Base with the opt-in still producing partial R2R / current merge default / current merge opt-in:

Base commit still uses partial ReadyToRun when full R2R is requested Current merge preserves partial ReadyToRun by default Current merge enables full ReadyToRun when opted in

Videos

Current merge, default partial R2R

merge-default-partial-interaction.mp4

Current merge, full R2R opt-in

merge-full-r2r-interaction.mp4

Verdict: the implementation and empirical behavior look good to merge after resolving the remaining review conversation.

@kubaflo
kubaflo merged commit a8f0b6f into net11.0 Aug 8, 2026
47 checks passed
@kubaflo
kubaflo deleted the jonathanpeppers-enable-android-full-r2r branch August 8, 2026 14:14
@github-actions github-actions Bot added this to the .NET 11.0-preview7 milestone Aug 8, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 8, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — a56f5243 Deployed Aug 4, 2026 by jonathanpeppers via conclusion #1145
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) platform/android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants