[TrimmableTypeMap] Bump WorkManager test's AndroidX to post-KMP-split versions#12002
Merged
Merged
Conversation
BuildTest.WorkManager uses XamarinFormsAndroidApplicationProject, whose Xamarin.Forms 5.0.0.2622 transitively pulls Xamarin.AndroidX.Fragment 1.5.5 and Xamarin.Google.Android.Material 1.4.0.2. Those were built before the androidx.collection Kotlin-Multiplatform split and carry dangling type references to AndroidX.Collection.SimpleArrayMap in the now type-less Xamarin.AndroidX.Collection facade (the type moved to Xamarin.AndroidX.Collection.Jvm without a type-forward being added). MonoVM/CoreCLR never notice (type references resolve lazily and this path is never exercised), but NativeAOT/ILC resolves the reference eagerly while building vtables for constructed types and fails with "Failed to load type 'AndroidX.Collection.SimpleArrayMap'". Reference a current Xamarin.Google.Android.Material (1.10.0.2), which references Xamarin.AndroidX.Collection.Jvm and depends on Xamarin.AndroidX.Fragment 1.6.2.1, so both stale transitive packages resolve to post-split versions. Fixes BuildTest.WorkManager on the trimmable/NativeAOT path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a test-only NativeAOT/trimmable build break in BuildTest.WorkManager caused by older Xamarin.Forms transitive AndroidX packages that reference types moved during the AndroidX.Collection KMP split.
Changes:
- Add an explicit reference to
KnownPackages.XamarinGoogleAndroidMaterialin the WorkManager test to force resolution to post-split AndroidX packages (includingXamarin.AndroidX.Collection.Jvm). - Document the rationale in the test to explain why the explicit package reference is needed for NativeAOT/ILC.
Show a summary per file
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs | Adds an explicit Material package reference (and explanation) to avoid NativeAOT failing on dangling AndroidX.Collection type refs in the WorkManager test. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
jonathanpeppers
approved these changes
Jul 7, 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
BuildTest.WorkManagerfails on the trimmable/NativeAOT path with:Root cause
The test uses
XamarinFormsAndroidApplicationProject, whoseXamarin.Forms 5.0.0.2622transitively pullsXamarin.AndroidX.Fragment 1.5.5andXamarin.Google.Android.Material 1.4.0.2. Both were built before theandroidx.collectionKotlin-Multiplatform split: the types (SimpleArrayMap,ArrayMap, …) later moved out ofXamarin.AndroidX.CollectionintoXamarin.AndroidX.Collection.Jvm, and the old facadeXamarin.AndroidX.Collection.dllwas emptied (0 types, 0 type-forwards) without a[TypeForwardedTo]being added.So those older assemblies carry a dangling
TypeRef[Xamarin.AndroidX.Collection]AndroidX.Collection.SimpleArrayMapthat now points at an empty assembly.SimpleArrayMapthrough the correct.Jvmreference from newer assemblies).Fix
Reference a current
Xamarin.Google.Android.Material(1.10.0.2, alreadyKnownPackages.XamarinGoogleAndroidMaterial). It referencesXamarin.AndroidX.Collection.Jvmand depends onXamarin.AndroidX.Fragment 1.6.2.1, so both stale Forms-transitive packages resolve to post-split versions and the dangling reference disappears.This is a test-only change (no product change) — the underlying binding-packaging issue (missing type-forward on the emptied
Xamarin.AndroidX.Collectionfacade) lives in the AndroidX bindings, not this repo.