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

Open
#12,221 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
62/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
android, csharp

Research direction

Start with external/Java.Interop/tests/Java.Interop-Tests/Java.Interop/JniRuntime.JniValueManagerTests.cs and the CreateValue test, then inspect the trimmable typemap value-manager path named in the failure. Reproduce using the listed project files and _AndroidTypeMapImplementation=trimmable. Done means CreateValue passes while the other four restored tests and non-trimmable coverage remain passing.

Written by the indexing model from the issue text.

Description

needs-triage
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()
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.