dotnet / dotnet/android

AndroidValueManager contract exact peer-count assertions fail on device

Open Beginner friendly
#12,224 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 21h
Merged PRs (30d)
257

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

```text
AddPeer_NoDuplicates: expected 2 surfaced peers, observed 3
ConstructPeer_ImplicitViaBindingConstructor_PeerIsInSurfacedPeers: expected 1, observed 2
ConstructPeer_ImplicitViaBindingMethod_PeerIsInSurfacedPeers: expected 0, observed 1
```

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.