Skip to content

[Xamarin.Android.Build.Tasks] Remove typemap implementation selector - #13024

Merged
simonrozsival merged 4 commits into
mainfrom
simonrozsival-typemap-property-removal
Oct 7, 2026
Merged

simonrozsival merged 4 commits into
mainfrom
simonrozsival-typemap-property-removal

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

The trimmable type map is the sole supported implementation after #12889 and #12890. $(AndroidTypeMapImplementation) no longer selects between working implementations, but still adds conditions, defaults, validation, and redundant test parameters throughout the build.

Remove the selector rather than preserving an extension point for a hypothetical future implementation:

  • Remove its defaults, property-cache entry, target/import conditions, and UCO binding prerequisite checks. Always select java_runtime_trimmable.jar; retain application/library, runtime, trimming, design-time, and inner-RID guards.
  • Simplify constant typemap test parameters while retaining the CoreCLR/NativeAOT matrices. Make the callback fixture reference and callback/manifest test sources unconditional, and remove the obsolete CoreCLRTrimmable test flavor default.
  • Replace selector-validation tests with coverage that applications still generate typemaps and libraries do not, regardless of obsolete assignments. Add standalone R8 target regression coverage for omitted, empty, llvm-ir, trimmable, and unknown values.
  • Retire XA4267, remove selector wording from XA4265/XA4266, and update build-property documentation, contributor guidance, and test commands. Generated non-English localization files are unchanged relative to main.

Compatibility: Existing assignments to $(AndroidTypeMapImplementation) are now ignored, including previously rejected llvm-ir, unknown, and explicitly empty global values. The documentation retains an obsolete-property notice so users can remove those assignments.

No linked issue; this follows the legacy typemap removal PRs and the redundant test-lane removal in #13011.

Validation

After merging main at 40160bdfb9 and resolving the latest test-guide conflict in 08d25beb13, expanded standalone coverage: 362 passed, 7 skipped, 0 failed. This includes the obsolete-property regression cases, transferred-reference activation tests, and upstream R8/NativeAOT object-extraction coverage. The skipped tests require locally built Android assemblies. NativeAOT target cases were exercised with the NDK tools.

dotnet test src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj -v minimal -p:_NativeAotLlvmReadObjPath=/Users/simon/android-toolchain/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-readobj --filter 'FullyQualifiedName~TypeMapProguardTargetsTests|FullyQualifiedName~GenerateTrimmableTypeMapTests|FullyQualifiedName~TrimmableTypeMapIncrementalTests|FullyQualifiedName~TrimmableTypeMapManifestAliasTests|FullyQualifiedName~TrimmableTypeMapRidCallbackTests|FullyQualifiedName~ExtractTypeMapKeysFromAssembliesTests|FullyQualifiedName~ExtractTypeMapKeysFromNativeAotObject|FullyQualifiedName~GenerateTypeMapProguardConfigurationTests|FullyQualifiedName~GenerateTypeMapMemberProguardConfigurationTests|FullyQualifiedName~TransferredReferenceActivationTests'

The earlier focused obsolete-property regression run passed all 5 cases; these cases also passed in the expanded run above:

dotnet test src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj -v minimal --filter 'Name~AssemblyTargetConsumesLinkedMetadataAcrossRidsAndEmptyStubs'

git diff --cached --check passed. All 12 modified XML files parsed successfully. The latest conflict resolution preserves all current-main testing guidance, including the moved on-device JNI test locations, with only the obsolete selector removed. All 81 non-overlapping upstream changes match main exactly.

Structural checks during the previous R8 conflict resolution in 6dda80c5ec confirmed:

  • All 204 retained target contracts preserve ordering, dependencies, hooks, incremental inputs/outputs, and non-selector conditions.
  • The upstream R8 target import and every non-selector property-cache entry are preserved.
  • All 84 runtime Compile items and five ProjectReference items are preserved; formerly selector-gated fixture entries remain unconditional.
  • The three conflicted test fixtures retain all 128 test methods and 180 explicit test cases after removing constant selector arguments. New fallback-producer, R8-policy, NativeAOT opt-in, and concurrent assembly-store coverage is preserved.

The latest merge makes no further product-target or typemap-test changes.

Full SDK validation is blocked: Retrying make prepare && make all on this merged revision failed during preparation with NU1102 because the configured feeds cannot supply Microsoft.NETCore.App.Ref version 10.0.13; make all did not run. Earlier attempts using make prepare MSBUILD_ARGS=-p:DotNetPreviewTool=/usr/local/share/dotnet/dotnet and dotnet build src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj -v minimal -p:DotNetStableTargetFramework=net11.0 failed for the same dependency. Full-build application/library regressions, device integration tests, and on-device runtime tests have therefore not run locally.


Pull Request
title and
description
should follow the
commit-messages.md workflow documentation, and in particular should include:

  • Useful description of why the change is necessary.
  • Links to issues fixed
  • Unit tests

The trimmable type map is the sole supported implementation.  Remove
AndroidTypeMapImplementation defaults, branching, cache input and
validation rather than retaining a selector with no alternative.

Make runtime fixtures unconditional and simplify the test matrices while
preserving CoreCLR and NativeAOT coverage.  Test that obsolete assignments
are ignored, retire XA4267, and update diagnostics and documentation.

Co-authored-by: Copilot App <[email protected]>
@simonrozsival
simonrozsival marked this pull request as ready for review October 6, 2026 14:19
Copilot AI balanced review requested due to automatic review settings October 6, 2026 14:19
@simonrozsival

Copy link
Copy Markdown
Member Author

@dalexsoto review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

It changes the shipped MSBuild pipeline, while full SDK, integration, and device validation remains blocked.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Removes the obsolete typemap implementation selector now that trimmable typemaps are universal.

Changes:

  • Always enables trimmable typemap targets and runtime artifacts.
  • Removes obsolete validation, defaults, and test parameters.
  • Updates diagnostics, tests, and documentation.
File Description
tests/​MSBuildDeviceIntegration/​Tests/​WebViewJavascriptInterfaceTests.cs Removes selector parameterization.
tests/​MSBuildDeviceIntegration/​Tests/​R8ObfuscationTests.cs Removes explicit selector assignment.
tests/​MSBuildDeviceIntegration/​Tests/​InterfaceCollectionTests.cs Removes explicit selector assignment.
tests/​MSBuildDeviceIntegration/​Tests/​InstallAndRunTests.cs Simplifies typemap test matrices.
tests/​Mono.Android-Tests/​Mono.Android-Tests/​Mono.Android.NET-Tests.csproj Unconditionally includes typemap fixtures.
tests/​Android.Benchmarks/​Android.Benchmarks.csproj Removes obsolete property.
src/​Xamarin.Android.Build.Tasks/​Xamarin.Android.Common.targets Always selects the trimmable pipeline and JAR.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​TrimmableTypeMapBuildTests.cs Tests obsolete values are ignored.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​Tasks/​LinkerTests.cs Removes obsolete test setup.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​PackagingTest.cs Removes obsolete test setup.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​InvalidConfigTests.cs Replaces selector validation tests.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​IncrementalBuildTest.cs Removes obsolete property.
src/​Xamarin.Android.Build.Tasks/​Tests/​Xamarin.Android.Build.Tests/​BindingBuildTest.cs Removes obsolete property.
src/​Xamarin.Android.Build.Tasks/​Properties/​Resources.resx Retires XA4267 and updates diagnostics.
src/​Xamarin.Android.Build.Tasks/​Properties/​Resources.Designer.cs Synchronizes generated resource descriptions.
src/​Xamarin.Android.Build.Tasks/​MSBuild/​Xamarin/​Android/​Xamarin.Android.Bindings.Core.targets Removes selector prerequisite validation.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.TypeMap.Trimmable.targets Removes selector conditions.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.TypeMap.Trimmable.CoreCLR.targets Unconditionally enables applicable CoreCLR targets.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.TypeMap.Proguard.targets Removes selector gates from R8 targets.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.NativeAOT.targets Removes selector default.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.DefaultProperties.targets Removes global selector default.
src/​Xamarin.Android.Build.Tasks/​Microsoft.Android.Sdk/​targets/​Microsoft.Android.Sdk.AssemblyResolution.targets Removes selector-dependent metadata conditions.
src/​Mono.Android/​Mono.Android.targets Removes callback selector validation.
src/​Microsoft.Android.Sdk.TrimmableTypeMap/​README.md Updates pipeline description.
src/​Microsoft.Android.Build.Tasks/​Tests/​Microsoft.Android.Build.Tasks.Tests/​TypeMapProguardTargetsTests.cs Adds obsolete-value regression coverage.
Documentation/​guides/​internals/​JavaJNI_Interop.md Documents universal trimmable typemaps.
Documentation/​docs-mobile/​TOC.yml Removes XA4267 entry.
Documentation/​docs-mobile/​messages/​xa4267.md Deletes retired diagnostic documentation.
Documentation/​docs-mobile/​messages/​xa4266.md Removes selector wording.
Documentation/​docs-mobile/​messages/​xa4265.md Updates unsupported-format guidance.
Documentation/​docs-mobile/​messages/​index.md Updates diagnostic index.
Documentation/​docs-mobile/​building-apps/​build-properties.md Marks the selector ineffective.
.github/​skills/​tests/​SKILL.md Updates test guidance.
.github/​skills/​tests/​references/​test-catalog.md Updates typemap test commands.
.github/​copilot-instructions.md Removes selector arguments from validation commands.
Files not reviewed (1)
  • src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs: Generated file

Comment thread .github/skills/tests/references/test-catalog.md Outdated

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The complete 35-file static review found no source blocker in retiring the selector. Ignoring obsolete assignments, using the sole trimmable pipeline/JAR, preserving non-selector guards, and unconditional fixture inclusion are accepted. Source/generated-resource, target/incremental and test-contract checks completed; optional local SDK/device limitations were not converted into findings.

One current platform blocker remains: this exact head is nonmergeable. Fresh GitHub metadata reports mergeable=false, mergeable_state=dirty, and rebaseable=false. Please resolve the conflicts and validate the resulting revision. The 43 successful exact-head checks do not clear the current conflicts. No conflict filename or compiled source failure is invented from those metadata fields.

Merge main to resolve the runtime test project conflict. Preserve the new transferred-reference fixture and include it unconditionally, matching the sole supported typemap implementation. Reword test guidance so it no longer implies an optional typemap mode.

Validation: 98 focused standalone tests passed, 7 skipped. All 12 modified XML files parsed, and all main-branch Compile and ProjectReference entries are preserved. Full SDK preparation remains blocked by missing Microsoft.NETCore.App.Ref 10.0.13 (NU1102).

Co-authored-by: Copilot App <[email protected]>
@simonrozsival

Copy link
Copy Markdown
Member Author

@dalexsoto Resolved the merge conflict in 88e2c4a by merging current main. The runtime test project preserves the new TransferredReferenceTests fixture and includes it unconditionally, consistent with removal of the selector. GitHub now reports mergeable=MERGEABLE; the previous conflict blocker is cleared.

Validation on the merged revision: 98 focused standalone tests passed, 7 skipped, 0 failed (including the new activation-cleanup tests). All 12 modified XML files parse, and all 84 Compile items and five ProjectReference items from main are preserved. Exact test commands and results are recorded in the PR description.

make prepare && make all was retried but preparation still fails with NU1102 for unavailable Microsoft.NETCore.App.Ref 10.0.13. Full local SDK/device validation remains outstanding. The new head had no reported CI checks when checked after pushing.

@simonrozsival
simonrozsival enabled auto-merge (squash) October 6, 2026 22:14

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The complete current 35-file source review found no source blocker. The merged TransferredReferenceTests and all 84 Compile/five ProjectReference items are preserved; ignored obsolete assignments, non-selector guards, imports, JAR/UCO, incremental/Clean contracts and generated diagnostics remain consistent. The separate integration/completeness and final sweeps completed; optional local SDK/device limitations were not converted into findings.

Resolve the newly observed current merge conflicts. Your earlier resolution on 88e2c4a was confirmed mergeable, but fresh GitHub metadata for this same head now reports mergeable=false and mergeable_state=dirty. The 42 successful exact-head checks do not clear the current platform conflict state. Please update against the target branch, resolve the conflicts and validate the resulting revision. This is newly observed platform evidence on the updated head, not a claim that your earlier resolution failed or that a source defect was found. No conflict filename or compiled source error is invented from those metadata fields.

Merge current main while retaining its R8 target import, policy cache inputs, fallback producer tests, NativeAOT opt-in coverage and concurrent assembly-store device test. Remove obsolete selector arguments from new typemap tests without dropping runtime or policy cases.

Validation: 362 focused standalone typemap and R8 tests passed, 7 skipped. All 12 modified XML files parse; 204 retained target contracts and all current-main test matrices in conflicted fixtures are preserved. Full SDK preparation remains blocked by unavailable Microsoft.NETCore.App.Ref 10.0.13 (NU1102).

Co-authored-by: Copilot App <[email protected]>
@simonrozsival

Copy link
Copy Markdown
Member Author

@dalexsoto Resolved the newly reported conflicts in 6dda80c by merging current main at a119e3c. GitHub now reports mergeable=MERGEABLE. The resolution preserves the new R8 target import, policy-cache inputs, fallback-producer and NativeAOT opt-in coverage, and concurrent assembly-store device test; only obsolete selector arguments were removed from the new tests.

Validation on the merged revision: 362 focused standalone typemap/R8 tests passed, 7 skipped, 0 failed. All 12 modified XML files parse. Structural checks confirm 204 retained target contracts preserve ordering, dependencies, hooks, incremental inputs/outputs and non-selector guards; all 128 test methods and 180 explicit cases in the conflicted fixtures are preserved. Exact commands and results are updated in the PR description.

make prepare && make all was retried and still fails during preparation with NU1102 for unavailable Microsoft.NETCore.App.Ref 10.0.13, so full local SDK/device validation remains outstanding. Azure DevOps build 1626120 is running for this exact source head; it has no final result yet.

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The complete current 36-file source audit is clean. The trimmable-only retirement preserves non-selector target/import/cache/Clean contracts, the merged R8 policy and RunILLink=false fallback, retained runtime/device fixtures, and English/generated diagnostic parity.

Current merge blocker: immediately refreshed metadata for 6dda80c still reports mergeable=false, mergeable_state=dirty, and rebaseable=false against main. This is fresh evidence for the updated head, not a carry-forward of the old 88e2c4a conflict or a claim that your earlier resolution never worked. Please update from current main and resolve the current conflicts while preserving the retained tests and upstream contracts. No conflict filename or compiler error is inferred from these platform fields.

I also inspected both new current-source CI reds in build 1626120. MAUI's arm64 default work item failed during APK installation with insufficient storage/UID allocation, before app execution. The dedicated JcwGen negative-control test detected its intentionally retained references but failed its literal Delta=100 message assertion on Delta=99; that test and its net-counter measurement helper are unchanged from the authorized base. Neither observation establishes a new typemap-retirement-specific source blocker. The sole confirmed blocker in this review is current mergeability, not pending CI or an inferred JNI-leak regression.

Merge main and preserve the updated on-device JNI test locations and standalone tooling guidance without restoring AndroidTypeMapImplementation. No product or test implementation changes are required by the conflict resolution.

Validation: 362 focused typemap/R8 tests passed, 7 skipped; all 12 modified XML files parse. Current-main testing guidance and all 81 non-overlapping upstream changes are preserved. make prepare remains blocked by unavailable Microsoft.NETCore.App.Ref 10.0.13 (NU1102), so full SDK/device validation is still outstanding.

Co-authored-by: Copilot App <[email protected]>
@simonrozsival

Copy link
Copy Markdown
Member Author

@dalexsoto Addressed the latest mergeability blocker in 08d25be by merging current main at 40160bd. The only conflict was in .github/skills/tests/SKILL.md: it now preserves the new on-device JNI test locations and standalone tooling guidance without restoring the retired selector. GitHub reports MERGEABLE for this new head.

Revalidated the merged revision: 362 focused typemap/R8 tests passed, 7 skipped, 0 failed; all 12 modified XML files parse. The resolved guide matches current main except for the intended selector removal, and all 81 non-overlapping upstream changes match main exactly. No unrelated JNI leak measurement or MAUI installation behavior was changed.

Retried make prepare && make all; preparation still fails with NU1102 for unavailable Microsoft.NETCore.App.Ref 10.0.13, so full local SDK/device validation remains blocked. The PR description records the current revision and exact validation commands/results.

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the complete current 36-file change and its source/generated/runtime/test integration. The main resolution preserves the relocated on-device JNI paths and standalone tooling guidance without restoring the retired selector; all 81 non-overlapping upstream units and rename origins were independently verified. The non-selector target/cache/Clean contracts, actual R8 import/policies/RunILLink=false fallback, NativeAOT opt-in, runtime fixtures and English/generated diagnostics remain intact. The earlier merge-conflict blocker is cleared by fresh current-head metadata. No blocking issue remains. This review's additional validation was static source/condition analysis, not local product execution; pending checks and optional preparation/device gaps are not treated as findings.

@simonrozsival
simonrozsival merged commit 0205e8c into main Oct 7, 2026
42 checks passed
@simonrozsival
simonrozsival deleted the simonrozsival-typemap-property-removal branch October 7, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants