[build] Disable CoreCLR ReadyToRun without trimming - #12445
[build] Disable CoreCLR ReadyToRun without trimming#12445jonathanpeppers wants to merge 4 commits into
Conversation
Add an enabled build test for the non-trimmed Release CoreCLR scenario where FixAbstractMethodsStep attempts to rewrite an R2R assembly and fails with XALNS7015. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 313238e1-f0ef-4218-b4ae-a124671f7881
There was a problem hiding this comment.
Pull request overview
Adds/adjusts test coverage in Xamarin.Android.Build.Tests to reproduce the CoreCLR Release (non-trimmed) failure path where FixAbstractMethodsStep attempts to rewrite a ReadyToRun (R2R) assembly and Mono.Cecil cannot write mixed-mode assemblies, without changing product behavior.
Changes:
- Removes the previously-ignored CoreCLR/non-trimmed variant of
SimilarAndroidXAssemblyNames. - Adds a new focused test intended to exercise the CoreCLR Release +
PublishTrimmed=falsescenario that can triggerXALNS7015.
Disable CoreCLR ReadyToRun and composite R2R when trimming is off, and emit XA0119 to explain how to enable it. This keeps non-trimmed assemblies as IL so LinkAssembliesNoShrink can safely rewrite them. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 313238e1-f0ef-4218-b4ae-a124671f7881
|
/review |
|
❌ Android PR Reviewer failed to deliver outputs. Please review the logs for details. Caution agentic threat detected DetailsPotential security threats were detected in the agent output. Review the workflow run logs for details.
|
There was a problem hiding this comment.
Caution
agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.
Details
Potential security threats were detected in the agent output.
Review the workflow run logs for details.
Generated by Android PR Reviewer for #12445 · gpt56 · 533.1 AIC · ⌖ 9.95 AIC · ⊞ 25.7K
Comment /review to run again
Comments that could not be inline-anchored
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.CoreCLR.targets:10
🤖 ❌ MSBuild targets — MSBuild global properties are immutable unless explicitly listed in TreatAsLocalProperty, so this assignment cannot disable PublishReadyToRun when it came from -p:PublishReadyToRun=true; the assignment on the next line likewise cannot disable a globally supplied PublishReadyToRunComposite. With -p:PublishTrimmed=false -p:PublishReadyToRun=true, _AndroidReadyToRunWithoutTrimming becomes true, but PublishReadyToRun remains true, so crossgen2 still runs…
Documentation/docs-mobile/messages/xa0119.md:48
🤖 PublishReadyToRun reference in Documentation/docs-mobile/building-apps/build-properties.md still says CoreCLR Release builds default this property to true and that composite R2R follows it, without mentioning the new PublishTrimmed=true prerequisite. Please update that public property documentation as part of this behavior change so users do not receive conflicting guidance.
Rule: Public behavior documentation
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.CoreCLR.targets:21
🤖 ❌ MSBuild targets — This assignment cannot disable ReadyToRun when PublishReadyToRun was supplied as a global property (for example, dotnet publish -p:PublishReadyToRun=true -p:PublishTrimmed=false), because MSBuild global properties are immutable during project evaluation. In that common invocation the warning claims R2R was disabled, but crossgen2 still runs and the original mixed-mode rewrite failure remains. Please handle the global-property case (or fail it explicitly) and add a…
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 313238e1-f0ef-4218-b4ae-a124671f7881
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 313238e1-f0ef-4218-b4ae-a124671f7881
Summary
PublishTrimmed=trueis required to use ReadyToRun_LinkAssembliesNoShrinkcan safely applyFixAbstractMethodsStepTesting
Xamarin.Android.Build.Testsbuilds successfullyFixAbstractMethodsOnReadyToRunAssemblypasses and asserts the XA0119 warningFixes: #11025