[xabt] Disable legacy assembly fixups for trimmable typemap - #12659
Open
simonrozsival wants to merge 3 commits into
Open
[xabt] Disable legacy assembly fixups for trimmable typemap#12659simonrozsival wants to merge 3 commits into
simonrozsival wants to merge 3 commits into
Conversation
Gate the untrimmed legacy resource, abstract method, and keep-alive assembly rewrites behind AndroidEnableLegacyCompatibilityAssemblyFixups. Preserve the existing default for LLVM-IR builds while disabling the fixups by default for the trimmable typemap. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The changes are coherent and tested, and the behavior is guarded behind a clearly documented opt-in property with typemap-specific defaults.
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Xamarin.Android.Build.Tasks/Tasks/LinkAssembliesNoShrink.cs — 💡 suggestion Maintainability — EnableLegacyCompatibilityAssemblyFixups has a = true… |
What changed in this PR
This PR introduces an opt-in MSBuild property to control “legacy compatibility” assembly rewrite steps in untrimmed builds, defaulting it off for the trimmable typemap and on for the LLVM-IR typemap. This aligns the untrimmed behavior more closely with the trimmable trimmed pipeline while retaining an escape hatch for older assemblies.
Changes:
- Added
AndroidEnableLegacyCompatibilityAssemblyFixupsand plumbed it intoLinkAssembliesNoShrink. - Defaulted the property to
falsefortrimmabletypemap builds andtruefor LLVM-IR typemap builds. - Added a focused unit test asserting the pipeline steps are included/excluded based on the new flag, and documented the property.
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets | Passes the new MSBuild property into LinkAssembliesNoShrink and includes it in the build properties cache. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs | Adds a unit test verifying pipeline-step presence is gated by the new flag. |
| src/Xamarin.Android.Build.Tasks/Tasks/LinkAssembliesNoShrink.cs | Gates FixAbstractMethodsStep, FixLegacyResourceDesignerStep, and AddKeepAlivesStep behind EnableLegacyCompatibilityAssemblyFixups. |
| src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.Trimmable.targets | Sets the default AndroidEnableLegacyCompatibilityAssemblyFixups to false for trimmable typemap builds (when unset by user). |
| src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.LlvmIr.targets | Sets the default AndroidEnableLegacyCompatibilityAssemblyFixups to true for LLVM-IR typemap builds (when unset by user). |
| Documentation/docs-mobile/building-apps/build-properties.md | Documents the new build property and its defaults. |
Document the untrimmed-only scope, log skipped compatibility fixups, preserve coverage for the common assembly pipeline, and exercise the trimmable default and explicit opt-in through a full build test. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Import the build task logging extensions required by the new diagnostic and clarify that the task property initializer is only the direct-caller fallback. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
jonathanpeppers
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
AndroidEnableLegacyCompatibilityAssemblyFixupsfalsefor the trimmable typemap andtruefor LLVM-IRFixAbstractMethodsStep,FixLegacyResourceDesignerStep, andAddKeepAlivesSteppasses behind the propertyLinkAssembliesNoShrinkscanning and staging behaviorTrimmed trimmable builds already exclude these compatibility rewriters, so this closes the remaining untrimmed path by default while retaining an escape hatch for older binding/resource-designer binaries in untrimmed builds.
Follow-up to #10842.
Validation
false, LLVM-IR defaults totrue, and an explicit trimmable opt-in remainstrueAndroidAddKeepAlivescases for trimmable default-off and explicit opt-in added for CI