Repository navigation
[TrimmableTypeMap] Preserve manifest attributes - #13210
Conversation
The trimmable manifest path scans metadata declared on an Application\ntype, but did not add those entries to the generated application element.\nThis caused value and resource metadata to disappear from CoreCLR and\nNativeAOT manifests.\n\nEmit the captured metadata when updating the application element and add\nbuild coverage for both runtimes.\n\nFixes #13175\n\nCo-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix reuses existing emission logic and includes regression coverage for both affected runtimes, with no identified blocking issues.
No open issues 🎉
What changed in this PR
Fixes #13175 by emitting application-level metadata in trimmable manifests for CoreCLR and NativeAOT.
Changes:
- Uses the existing metadata helper to emit captured application metadata.
- Adds integration tests covering value-backed and resource-backed metadata for both runtimes.
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/TrimmableTypeMapBuildTests.cs | Adds application metadata regression coverage. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/Generator/ComponentElementBuilder.cs | Emits captured metadata into the application element. |
Review effort: Balanced
Emit manifest-affecting attributes that were previously skipped by the trimmable type map generator, and cover the generated output for CoreCLR and NativeAOT. Fixes #13175 Co-authored-by: Copilot App <[email protected]>
|
/review |
|
✅ Android PR Reviewer completed successfully! Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
|
There was a problem hiding this comment.
⚠️ Needs Changes
Found 2 errors and 1 warning:
- Type-level and assembly-level
[Application]use divergent mapping tables, leaving many valid properties silently un-emitted depending on attribute target. GwpAsan.Defaultloses its explicit legacy manifest value.- Assembly instrumentation can duplicate a declaration already supplied by the manifest template.
The scanner-to-generator plumbing and CoreCLR/NativeAOT coverage are otherwise well structured. CI is still in progress (the completed Android Tools macOS check and CLA check are passing), so there is not yet a final green result.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
azcliprod.blob.core.windows.net
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
Generated by Android PR Reviewer for #13210 · copilot · gpt56 · 203.9 AIC · ⌖ 8.7 AIC · ⊞ 26.9K
Comment /review to run again
Co-authored-by: Copilot App <[email protected]>
|
/review |
|
✅ Android PR Reviewer completed successfully! Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
|
There was a problem hiding this comment.
⚠️ Needs Changes
Found 1 warning: type-level [UsesLibrary] can duplicate a library already present in the manifest template instead of preserving the legacy name-based merge behavior.
The earlier application-mapping, GwpAsan.Default, and assembly-instrumentation concerns are addressed, and the expanded CoreCLR/NativeAOT parity coverage is otherwise solid. CI is still in progress; the completed Android Tools checks and CLA check are passing.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
azcliprod.blob.core.windows.net
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
Generated by Android PR Reviewer for #13210 · copilot · gpt56 · 351.6 AIC · ⌖ 8.53 AIC · ⊞ 28.4K
Comment /review to run again
Co-authored-by: Copilot App <[email protected]>
|
/review |
|
✅ Android PR Reviewer completed successfully! Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
|
There was a problem hiding this comment.
❌ Reject — 2 errors.
The expanded manifest surface and CoreCLR/NativeAOT coverage are valuable, but two collision cases still diverge from the legacy generator: assembly-level [Application] values no longer override manifest-template attributes, and type-level [UsesLibrary] values incorrectly take precedence over assembly-level declarations. Both can change the packaged manifest without a diagnostic.
CI build 1641778 is still in progress: the macOS Android Tools test and CLA checks have passed, four platform checks are running, and the aggregate check is queued; no CI failure is currently reported.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
azcliprod.blob.core.windows.net
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
Generated by Android PR Reviewer for #13210 · copilot · gpt56 · 400 AIC · ⌖ 7.15 AIC · ⊞ 28.4K
Comment /review to run again
Co-authored-by: Copilot App <[email protected]>
|
/review |
|
✅ Android PR Reviewer completed successfully! Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
|
There was a problem hiding this comment.
Found two remaining manifest-parity issues: type-level BackupAgent now bypasses the legacy subtype validation, and ApplicationCategories.Undefined is silently dropped instead of preserving the legacy build failure. Inline comments include concrete test recommendations.
CI is still in progress; the completed checks are green.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
azcliprod.blob.core.windows.net
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
Generated by Android PR Reviewer for #13210 · copilot · gpt56 · 406 AIC · ⌖ 7.1 AIC · ⊞ 28.4K
Comment /review to run again
Co-authored-by: Copilot App <[email protected]>
|
/review |
|
✅ Android PR Reviewer completed successfully! Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
|
There was a problem hiding this comment.
Review summary
Found 1 warning: the new RequiredContentUriPermission and GwpAsan conversions do not preserve legacy validation for unsupported numeric enum values, allowing invalid declarations to build while silently omitting the manifest attribute.
Verdict: needs a small validation fix before merge.
CI build #1641839 is still in progress; the completed Android Tools macOS lane and CLA check are passing, while the platform builds have not completed yet.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
azcliprod.blob.core.windows.net
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
Generated by Android PR Reviewer for #13210 · copilot · gpt56 · 153.9 AIC · ⌖ 7.08 AIC · ⊞ 28.4K
Comment /review to run again
Co-authored-by: Copilot App <[email protected]>
|
/review |
|
✅ Android PR Reviewer completed successfully! Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
|
There was a problem hiding this comment.
❌ Reject
Found 2 errors and 1 warning: assembly-level application type references are not rooted for trimming, provider permission values skip legacy @PACKAGE_NAME@ substitution, and type-valued application properties discard assembly identity during peer resolution.
The expanded manifest-parity coverage and consolidation of application mappings are valuable, but these correctness gaps can still produce manifests or trimmed applications that diverge from the legacy path.
CI is still running: both Android Tools test checks and CLA are green; the platform builds remain in progress and the aggregate check is queued. Azure timeline details were unavailable because this runner has no Azure DevOps login.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
azcliprod.blob.core.windows.net
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
Generated by Android PR Reviewer for #13210 · copilot · gpt56 · 509.8 AIC · ⌖ 7.36 AIC · ⊞ 28.4K
Comment /review to run again
|
✅ Android PR Reviewer completed successfully! Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
|
There was a problem hiding this comment.
The expanded manifest-parity coverage is strong, especially around precedence, enum validation, trimming roots, and CoreCLR/NativeAOT integration. One legacy-parity gap remains for assembly-level ApplicationAttribute.Name, which can produce the wrong application class in the generated manifest.
CI build 1642152 is still in progress: the two Android Tools test checks reported so far passed, while the platform builds and aggregate check have not completed.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
azcliprod.blob.core.windows.net
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
Generated by Android PR Reviewer for #13210 · copilot · gpt56 · 303.8 AIC · ⌖ 7.06 AIC · ⊞ 28.4K
Comment /review to run again
Co-authored-by: Copilot App <[email protected]>
|
/review |
|
✅ Android PR Reviewer completed successfully! Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
|
There was a problem hiding this comment.
The manifest parity and trimming coverage is substantially improved, but the new component-child attribute scanning can mistake unrelated user-defined attributes for Android manifest attributes because it compares only simple type names. The inline comment identifies the affected branches and the namespace-aware helper already available in this scanner.
CI is still in progress: the macOS Android tools lane and CLA check have passed; the platform build lanes remain running.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
azcliprod.blob.core.windows.net
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"See Network Configuration for more information.
Generated by Android PR Reviewer for #13210 · copilot · gpt56 · 611.9 AIC · ⌖ 7.02 AIC · ⊞ 28.4K
Comment /review to run again
Co-authored-by: Copilot App <[email protected]>
|
/review |
|
✅ Android PR Reviewer completed successfully!
|
There was a problem hiding this comment.
The manifest parity coverage is broad, and the new application-property precedence, type-reference rooting, and framework-attribute namespace checks are well exercised. One namespace-collision issue remains in assembly-level instrumentation discovery: a same-named user attribute can be interpreted as Android.App.InstrumentationAttribute and alter the generated manifest.
CI is still in progress; CLA has passed and no failing check is currently reported.
Generated by Android PR Reviewer for #13210 · copilot · gpt56 · 153.1 AIC · ⌖ 7.04 AIC · ⊞ 28.4K
Comment /review to run again
Co-authored-by: Copilot App <[email protected]>
simonrozsival
left a comment
There was a problem hiding this comment.
Consolidated offline review
The PR broadly restores parity between the trimmable and legacy manifest generators. Yesterday's repeated findings mostly reduce to a few invariants: compare Android attributes by qualified identity; preserve legacy mapping, validation, ordering, and duplicate semantics; and ensure manifest-referenced types survive trimming. The fixes for the previously reported mapping, enum, precedence, duplicate, package-token, validation, and rooting cases are present. This pass found two remaining gaps: namespace-qualified recognition is not consistent for all type-level manifest attributes, and type-level instrumentation intent filters are not emitted.
CI is not green: build 1642228 failed after Azure Pipelines stopped hearing from a macOS agent; the failed test task also exited with a null code, so this does not currently identify a PR code regression.
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
|
/review |
|
✅ Android PR Reviewer completed successfully!
|
There was a problem hiding this comment.
⚠️ Needs Changes
1 ❌ error, 1
The shared application mapping table, namespace-qualified attribute matching, and expanded manifest/retention coverage are good improvements. I checked the changes against the full source files and the legacy manifest-generation paths.
CI: All 41 GitHub checks report success, including the aggregate dotnet-android check for Azure build 1653277. Direct Azure build/timeline verification was unavailable, so that result is based on GitHub check reporting rather than an independent Azure confirmation.
Local validation: The attempted focused reproduction stopped before compilation because the installed .NET CLI failed initializing NuGet migrations. The findings are based on source/data-flow analysis, not a successful local execution. No repository files were changed by this review.
Generated by Android PR Reviewer for #13210 · copilot · gpt61 · 121 AIC · ⌖ 7.92 AIC · ⊞ 19.3K
Comment /review to run again
Co-authored-by: Copilot App <[email protected]>
|
/release |
|
/review |
|
✅ Android PR Reviewer completed successfully!
|
There was a problem hiding this comment.
⚠️ Needs Changes
Reviewed all 17 changed files in full and traced the affected scanner, manifest, and typemap paths against the legacy generator. 2 errors, 0 warnings, 0 suggestions, detailed inline:
- Tokenized assembly-level component names are emitted after substitution but looked up for rooting before substitution, allowing manifest-only peers to be trimmed.
- An explicitly empty type-level
Application.Nameoverwrites the computed Java class name instead of retaining the legacy fallback.
The shared application mappings, namespace-qualified attribute matching, assembly-aware type-reference lookup, and CoreCLR/NativeAOT regression coverage are useful improvements.
CI: GitHub reports all 41 checks successful, including dotnet-android build 1654567. Direct Azure build verification was unavailable because the Azure CLI required authentication, so I could not independently confirm the pipeline result.
Local validation: Attempted dotnet test src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj --no-restore --filter 'FullyQualifiedName~TrimmableTypeMapManifestAliasTests|FullyQualifiedName~GenerateTrimmableTypeMapTests' -v minimal; .NET initialization failed while creating the NuGet-Migrations mutex, before tests ran. Findings are based on source-path analysis; no repository files were changed.
Generated by Android PR Reviewer for #13210 · copilot · gpt61 · 93.9 AIC · ⌖ 8.09 AIC · ⊞ 19.4K
Comment /review to run again
Co-authored-by: Copilot App <[email protected]>
The trimmable manifest generator captured many manifest-affecting attributes but did not consistently emit them or preserve the legacy generator's behavior. As a result, CoreCLR and NativeAOT could produce manifests that differed from legacy builds, and full trimming could remove managed types named by generated manifest entries.
This change broadens parity across assembly- and type-level application, component, provider, and instrumentation declarations. It emits the missing attributes and child elements; matches attributes by namespace and name; preserves legacy validation, enum conversion, precedence, and template de-duplication; resolves type references with assembly identity; roots generated component names and application type references before typemap generation; and applies
@PACKAGE_NAME@substitution only to generated values. Regression coverage checks the generated manifests and full-trim retention on both CoreCLR and NativeAOT.Fixes #13175
Validation passed:
make prepare CONFIGURATION=Debug && make leeroy CONFIGURATION=Debug— build succeeded, 0 errors.dotnet test src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj --filter 'FullyQualifiedName~TrimmableTypeMapManifestAliasTests|FullyQualifiedName~GenerateTrimmableTypeMapTests' -v minimal— 47 passed../dotnet-local.sh test bin/TestDebug/net10.0/Xamarin.Android.Build.Tests.dll --filter 'Name~ManifestAttributesAreGeneratedForTrimmableComponents|Name~AssemblyApplicationOverridesManifestTemplate' -v:minimal— 4 passed across CoreCLR and NativeAOT.