Uh oh!
There was an error while loading. Please reload this page.
Migrate GenerateProguardConfiguration from ILLink step to MSBuild task - #10694
Conversation
The new task runs AfterTargets="ILLink" and uses System.Reflection.Metadata instead of Mono.Cecil to scan linked assemblies.
Uh oh!
There was an error while loading. Please reload this page.
jonathanpeppers
commented
Jan 16, 2026
There was a problem hiding this comment.
Pull request overview
This PR migrates the GenerateProguardConfiguration functionality from an ILLink custom step (using Mono.Cecil) to an MSBuild task (using System.Reflection.Metadata). The task runs after the ILLink target and scans linked assemblies to generate ProGuard configuration rules for Android callable wrapper (ACW) types.
Changes:
- Added new MSBuild task
GenerateProguardConfigurationusing System.Reflection.Metadata for assembly inspection - Updated MSBuild targets to invoke the new task after ILLink instead of as a linker custom step
- Removed the old ILLink step implementation that used Mono.Cecil
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tasks/GenerateProguardConfiguration.cs | New MSBuild task that scans linked assemblies for RegisterAttribute and generates ProGuard keep rules |
| src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.ILLink.targets | Added targets to prepare linked assemblies and invoke the new task; removed old linker custom step configuration |
| src/Microsoft.Android.Sdk.ILLink/GenerateProguardConfiguration.cs | Deleted old ILLink step implementation |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
sbomer
commented
Feb 8, 2026
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
In NativeAOT builds, ResolvedFileToPublish is not populated until _AndroidComputeIlcCompileInputs runs (after ILLink), so the proguard generation targets were reading an empty assembly list and missing the entry-point assembly. This caused R8 to strip Java classes needed at runtime, resulting in ClassNotFoundException. Use a property-based AfterTargets approach: _GenerateProguardAfterTargets defaults to ILLink for the standard path, and NativeAOT.targets overrides it to _AndroidComputeIlcCompileInputs. Also switch from ManagedAssemblyToLink (which never includes the entry-point assembly) to ResolvedFileToPublish filtered to .dll, which correctly includes all assemblies in both paths.
# Conflicts: # src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.ILLink.targets
…ation.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ation.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
sbomer
commented
Feb 13, 2026
@jonathanpeppers I think this is ready to go, PTAL! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.

The new task runs AfterTargets="ILLink" and uses System.Reflection.Metadata instead of Mono.Cecil to scan linked assemblies.