Repository navigation
[Android] Add full ReadyToRun opt-in - #37094
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 14d40ad5-6e1e-4491-9965-c95cc93958fe
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37094Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37094" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
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.targetsto apply--partialCrossgen2 args and default MIBC profiles only whenMauiEnableFullReadyToRunis nottrue. - Extend MSBuild unit test infrastructure to allow running
dotnet msbuild. - Add MSBuild coverage validating the property’s unset /
false/truebehaviors.
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. |
.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>
Empirical validation: merge-ready after one housekeeping itemI independently reviewed and tested this change and found no code or behavioral blocker. GitHub currently reports What I tested
The binlog diff shows the intended switch precisely: The expected size tradeoff is visible too:
Official CI is green: The installed Android pack ( ScreenshotsBase with the opt-in still producing partial R2R / current merge default / current merge opt-in: VideosCurrent merge, default partial R2R merge-default-partial-interaction.mp4Current merge, full R2R opt-in merge-full-r2r-interaction.mp4Verdict: the implementation and empirical behavior look good to merge after resolving the remaining review conversation. |



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
MauiEnableFullReadyToRunMSBuild property for .NET MAUI Android CoreCLR Release builds.Setting the property to
trueopts into full ReadyToRun compilation by omitting MAUI's--partialCrossgen2 argument and default MIBC profiles. Leaving it unset or setting it tofalsepreserves the existing partial ReadyToRun behavior.Includes workload-neutral MSBuild coverage for the unset,
false, andtruecases.Companion PR: dotnet/android#12299 documents the property and excludes the generated main-assembly MIBC profile when full ReadyToRun is enabled.
Closes #36587