Skip to content

[Xamarin.Android.Build.Tasks] Reject legacy AOT disable on CoreCLR - #12956

Merged
vitek-karas merged 2 commits into
mainfrom
vitek-karas-reject-legacy-aot-disable
Sep 30, 2026
Merged

vitek-karas merged 2 commits into
mainfrom
vitek-karas-reject-legacy-aot-disable

Conversation

@vitek-karas

Copy link
Copy Markdown
Member

Setting $(RunAOTCompilation) to false on CoreCLR silently leaves ReadyToRun compilation enabled. Starting with .NET 11, users must set $(PublishReadyToRun) to false instead.

Report XA1044 for the explicitly disabled legacy property with guidance for disabling ReadyToRun. Capture enabled and disabled settings before resetting unsupported Mono properties, preserving the existing parameterized diagnostic for enabled properties and allowing RunAOTCompilation=false on NativeAOT.

Update the property and error documentation, and expand configuration tests for Debug/Release, enabled/disabled Mono AOT properties, ReadyToRun settings, and NativeAOT compatibility.

Validation: 108 MSBuild evaluations passed across runtime, configuration, AOT, LLVM, and ReadyToRun settings. XML/resource/documentation consistency checks and git diff --check passed. Full-build integration tests were not run because the locally built Android SDK is unavailable.

No linked issue.


Pull Request
title and
description
should follow the
commit-messages.md workflow documentation, and in particular should include:

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

vitek-karas and others added 2 commits September 30, 2026 17:24
Setting RunAOTCompilation=false on CoreCLR silently leaves ReadyToRun
compilation enabled.  Reject the legacy setting with XA1044 and direct
users to PublishReadyToRun=false starting with .NET 11.

Capture explicitly enabled and disabled settings before resetting the
unsupported Mono properties.  Preserve the existing parameterized error
for enabled properties and allow the disabled setting on NativeAOT.

Expand configuration regression coverage and document the migration.

Co-authored-by: Copilot App <[email protected]>
@vitek-karas
vitek-karas marked this pull request as ready for review September 30, 2026 15:31
Copilot AI balanced review requested due to automatic review settings September 30, 2026 15:31

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.

Copilot review overview

🟢 Approval recommended

The implementation and documentation are consistent, with only a minor additional NativeAOT regression-test suggestion.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Rejects RunAOTCompilation=false for CoreCLR and directs .NET 11 users to PublishReadyToRun=false.

Changes:

  • Adds an XA1044 variant for disabled legacy AOT.
  • Preserves NativeAOT compatibility.
  • Expands tests and documentation.
File Description
Xamarin.Android.Common.targets Emits the new XA1044 diagnostic.
InvalidConfigTests.cs Tests CoreCLR and NativeAOT configurations.
Resources.resx Adds the localized error text.
Resources.Designer.cs Adds the generated resource accessor.
Microsoft.Android.Sdk.DefaultProperties.targets Captures enabled and disabled legacy settings.
xa1044.md Documents the new diagnostic.
build-properties.md Documents the .NET 11 migration.
Files not reviewed (1)
  • src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs: Generated file

@jonathanpeppers

Copy link
Copy Markdown
Member

After we get this merged, I can take care of the backport to release/11.0.1xx.

@vitek-karas
vitek-karas enabled auto-merge (squash) September 30, 2026 16:23
@vitek-karas
vitek-karas merged commit 82ecf39 into main Sep 30, 2026
45 checks passed
@vitek-karas
vitek-karas deleted the vitek-karas-reject-legacy-aot-disable branch September 30, 2026 17:38
@jonathanpeppers

Copy link
Copy Markdown
Member

/backport to release/11.0.1xx

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

@jonathanpeppers backporting to release/11.0.1xx failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git cherry-pick 82ecf397120de4108f8e6c34063c94f52146f9b4

Auto-merging Documentation/docs-mobile/building-apps/build-properties.md
CONFLICT (content): Merge conflict in Documentation/docs-mobile/building-apps/build-properties.md
Auto-merging Documentation/docs-mobile/messages/xa1044.md
CONFLICT (content): Merge conflict in Documentation/docs-mobile/messages/xa1044.md
Auto-merging src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets
CONFLICT (content): Merge conflict in src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets
Auto-merging src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs
Auto-merging src/Xamarin.Android.Build.Tasks/Properties/Resources.resx
Auto-merging src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InvalidConfigTests.cs
CONFLICT (content): Merge conflict in src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InvalidConfigTests.cs
Auto-merging src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
error: could not apply 82ecf3971... [Xamarin.Android.Build.Tasks] Reject legacy AOT disable on CoreCLR (#12956)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"


$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: [Xamarin.Android.Build.Tasks] Reject legacy AOT disable on CoreCLR
Using index info to reconstruct a base tree...
M	Documentation/docs-mobile/building-apps/build-properties.md
M	Documentation/docs-mobile/messages/xa1044.md
M	src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets
M	src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs
M	src/Xamarin.Android.Build.Tasks/Properties/Resources.resx
M	src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InvalidConfigTests.cs
M	src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
Falling back to patching base and 3-way merge...
Auto-merging Documentation/docs-mobile/building-apps/build-properties.md
CONFLICT (content): Merge conflict in Documentation/docs-mobile/building-apps/build-properties.md
Auto-merging Documentation/docs-mobile/messages/xa1044.md
CONFLICT (content): Merge conflict in Documentation/docs-mobile/messages/xa1044.md
Auto-merging src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets
CONFLICT (content): Merge conflict in src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets
Auto-merging src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs
Auto-merging src/Xamarin.Android.Build.Tasks/Properties/Resources.resx
Auto-merging src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InvalidConfigTests.cs
CONFLICT (content): Merge conflict in src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InvalidConfigTests.cs
Auto-merging src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 [Xamarin.Android.Build.Tasks] Reject legacy AOT disable on CoreCLR
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

jonathanpeppers added a commit that referenced this pull request Oct 1, 2026
* [Xamarin.Android.Build.Tasks] Reject legacy AOT disable on CoreCLR

Backport #12956 to release/11.0.1xx, capturing the explicitly disabled setting before Mono AOT defaults are applied. Preserve Mono and NativeAOT behavior and update diagnostics, docs, and configuration tests.

* [tests] Stop setting Mono AOT disable on CoreCLR fixtures

CoreCLR test projects formerly set RunAOTCompilation=false through AotAssemblies and per-ABI test setup. With XA1044 rejecting that legacy property, these fixtures fail before reaching the behavior they test. Omit Mono AOT settings for CoreCLR, retaining intentional invalid-configuration coverage and existing ReadyToRun defaults.

Co-authored-by: Copilot App <[email protected]>
jfversluis pushed a commit to dotnet/docs-mobile that referenced this pull request Oct 2, 2026
Sync the merged dotnet/android#12956 guidance so CoreCLR users remove RunAOTCompilation=false and disable ReadyToRun with PublishReadyToRun=false instead. Preserve NativeAOT compatibility and supported .NET 10-and-earlier Mono guidance.

Co-authored-by: Copilot App <[email protected]>
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.

3 participants