Move FixLegacyResourceDesignerStep to post-trim pipeline#11059
Open
Move FixLegacyResourceDesignerStep to post-trim pipeline#11059
Conversation
Migrate FixLegacyResourceDesignerStep out of the ILLink trimmer process and into PostTrimmingPipeline, continuing the work in #10842 to remove custom ILLink steps. The step now runs after ILLink via a thin wrapper (PostTrimmingFixLegacyResourceDesignerStep) that calls ProcessAssemblyDesigner() directly, matching the former ILLink behavior. - Remove all #if ILLINK conditionals from FixLegacyResourceDesignerStep, LinkDesignerBase, and BaseStep - Remove FixLegacyResourceDesignerStep and LinkDesignerBase from the ILLink project (no longer compiled as a trimmer step) - Add UseDesignerAssembly property to PostTrimmingPipeline task - Wire AndroidUseDesignerAssembly through targets to PostTrimmingPipeline - Remove _TrimmerCustomSteps entry for FixLegacyResourceDesignerStep
Contributor
There was a problem hiding this comment.
Pull request overview
Moves FixLegacyResourceDesignerStep out of the ILLink custom-step mechanism and into the PostTrimmingPipeline MSBuild task so the legacy designer fix runs after ILLink, aligning with the ongoing effort to eliminate _TrimmerCustomSteps-based customization.
Changes:
- Adds a
UseDesignerAssemblyswitch toPostTrimmingPipelineand runs the legacy resource-designer fix via a thin post-trim wrapper. - Removes
FixLegacyResourceDesignerStep/LinkDesignerBasefrom theMicrosoft.Android.Sdk.ILLinkproject and deletes the corresponding_TrimmerCustomStepsregistration. - Removes
#if ILLINKconditional paths from the step/base classes now that they no longer compile into the ILLink step assembly.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj | Ensures linker-related sources used by PostTrimmingPipeline include LinkDesignerBase. |
| src/Xamarin.Android.Build.Tasks/Tasks/PostTrimmingPipeline.cs | Adds UseDesignerAssembly and invokes the legacy designer fix post-ILLink via PostTrimmingFixLegacyResourceDesignerStep. |
| src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.LlvmIr.targets | Removes _TrimmerCustomSteps registration for the legacy designer fix and wires AndroidUseDesignerAssembly into PostTrimmingPipeline. |
| src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/LinkDesignerBase.cs | Removes ILLink-specific conditional logging paths. |
| src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/FixLegacyResourceDesignerStep.cs | Makes the step unconditionally implement the post-trim pipeline interface and removes ILLink-only conditionals. |
| src/Xamarin.Android.Build.Tasks/Linker/External/Linker.Steps/BaseStep.cs | Removes ILLink-specific conditional error logging path. |
| src/Microsoft.Android.Sdk.ILLink/Microsoft.Android.Sdk.ILLink.csproj | Stops compiling FixLegacyResourceDesignerStep and LinkDesignerBase into the ILLink step assembly. |
simonrozsival
approved these changes
Mar 31, 2026
Member
|
Somehow a lot of tests get an error like: Maybe the assembly resolver is missing some search directories? And that is what made it work before this change? |
In NativeAOT builds, _AddResourceDesignerToPublishFiles ran after _ComputeManagedAssemblyToLink, so the designer assembly was not in ManagedAssemblyToLink. ILLink skipped the designer assembly entirely and did not rewrite its netstandard references. Fix by adding _AddResourceDesignerToPublishFiles to _PrepareLinking's DependsOnTargets, so the designer is passed to ILLink.
# Conflicts: # src/Microsoft.Android.Sdk.ILLink/Microsoft.Android.Sdk.ILLink.csproj
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.
Migrate FixLegacyResourceDesignerStep out of the ILLink trimmer process and into PostTrimmingPipeline, continuing the work in #10842 to remove custom ILLink steps. The step now runs after ILLink via a thin wrapper (PostTrimmingFixLegacyResourceDesignerStep) that calls ProcessAssemblyDesigner() directly, matching the former ILLink behavior.