Skip to content

AndroidValueManager contract exact peer-count assertions fail on device #12224

Description

@jonathanpeppers

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssues that need to be assigned.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions