AndroidValueManager contract exact peer-count assertions fail on device

Open Beginner friendly
#12,224 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
android, csharp

Research direction

Start with tests/Mono.Android-Tests/Java.Interop-Tests/Java.InteropTests/AndroidValueManagerContractTests.cs and inspect how the fixture is selected for UseMonoRuntime and supported test lanes. Verify the TrimmableTypeMapUnsupported category on device, with the fixture excluded from supported CoreCLR and trimmable lanes while remaining available for the forced MonoVM configuration.

Written by the indexing model from the issue text.

Description

Android framework version

net11.0-android (Preview)

Affected platform version

.NET 11 Preview 7, forced unsupported MonoVM configuration

Description

Restoring the Android-specific AndroidValueManagerContractTests fixture on device exposes three incompatible inherited Java.Interop contract assertions:

  • AddPeer_NoDuplicates
  • ConstructPeer_ImplicitViaBindingConstructor_PeerIsInSurfacedPeers
  • ConstructPeer_ImplicitViaBindingMethod_PeerIsInSurfacedPeers

These tests assert exact changes in GetSurfacedPeers().Count. On Android, constructing the bound test peers also surfaces related framework wrappers, so the count grows by more than one even when the tested peer has only one mapping. Marking the fixture nonparallel does not change the result.

AndroidValueManager is only selected by MonoVM. CoreCLR uses JavaMarshalValueManager, while the trimmable/NativeAOT paths use their own value managers. MonoVM mobile targets are unsupported in .NET 11, so this fixture should not compile into supported .NET 11 test lanes.

Steps to Reproduce
  1. Include tests/Mono.Android-Tests/Java.Interop-Tests/Java.InteropTests/AndroidValueManagerContractTests.cs.
  2. Force the unsupported MonoVM configuration with UseMonoRuntime=true and _DisableCheckForUnsupportedMonoMobileRuntime=true.
  3. Build/install and run the TrimmableTypeMapUnsupported category on device.
Did you find any workaround?

Keep the Android-specific fixture conditional on UseMonoRuntime=true. Supported CoreCLR and trimmable lanes exclude it because they do not instantiate AndroidValueManager.

Relevant log output
AddPeer_NoDuplicates: expected 2 surfaced peers, observed 3
ConstructPeer_ImplicitViaBindingConstructor_PeerIsInSurfacedPeers: expected 1, observed 2
ConstructPeer_ImplicitViaBindingMethod_PeerIsInSurfacedPeers: expected 0, observed 1
Dominant language
C#
Stars
2.1k
Forks
580
Avg merge
2d 19m
Merged PRs (30d)
228

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/android

All issues in dotnet/android

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.