Skip to content

Trimmable typemap fails Java.Interop value-manager CreateValue contract test #12221

Description

@jonathanpeppers

Android framework version

net11.0-android (Preview)

Affected platform version

.NET 11 Preview 7, CoreCLR with _AndroidTypeMapImplementation=trimmable

Description

Restoring Java.InteropTests.JniRuntimeJniValueManagerTests device-test coverage shows that four of its five tests pass under the trimmable typemap. CreateValue fails because its test ReflectionJniValueManager delegates marshaler lookup to the current runtime value manager, and TrimmableTypeMapValueManager.GetValueMarshalerCore(Type) throws NotSupportedException.

Expected: either the test's reflection value manager can resolve the IJavaPeerable marshaler under the trimmable typemap, or the test can be adapted to exercise supported trimmable behavior.

Actual: the test fails with GetValueMarshalerCore should not be called in the trimmable typemap path.

This is the only failing method in the restored fixture; GetValue_ReturnsAlias, GetValue_ReturnsNullWithInvalidSafeHandle, GetValue_ReturnsNullWithNullHandle, and PeekValue pass.

Steps to Reproduce

  1. Include external/Java.Interop/tests/Java.Interop-Tests/Java.Interop/JniRuntime.JniValueManagerTests.cs in Java.Interop-Tests.NET.csproj.
  2. Build and install tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj with -p:UseMonoRuntime=false -p:_AndroidTypeMapImplementation=trimmable.
  3. Run the on-device test suite.
  4. Observe Java.InteropTests.JniRuntimeJniValueManagerTests.CreateValue fail.

Did you find any workaround?

Exclude only Java.InteropTests.JniRuntimeJniValueManagerTests.CreateValue by fully-qualified NUnit test name when RuntimeFeature.TrimmableTypeMap is enabled. This retains the other four tests and all non-trimmable runtime coverage.

Relevant log output

System.NotSupportedException : GetValueMarshalerCore should not be called in the trimmable typemap path.
   at Microsoft.Android.Runtime.TrimmableTypeMapValueManager.GetValueMarshalerCore(Type type)
   at Java.Interop.JniRuntime.JniValueManager.GetValueMarshaler(Type type)
   at Java.Interop.JavaPeerableValueMarshaler.CreateGenericValue(...)
   at Java.Interop.JniRuntime.ReflectionJniValueManager.CreateValueCore(...)
   at Java.InteropTests.JniRuntimeJniValueManagerTests.CreateValue()

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