[tests] Exclude value marshaler tests from trimmable typemap#1478
Open
simonrozsival wants to merge 3 commits into
Open
[tests] Exclude value marshaler tests from trimmable typemap#1478simonrozsival wants to merge 3 commits into
simonrozsival wants to merge 3 commits into
Conversation
The trimmable typemap runtime no longer supports the reflection-based value marshaler API path. Mark the value marshaler contract tests as unsupported for trimmable typemap runs, and also exclude the known JniPeerMembers constructor path failure for a follow-up fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the Java.Interop NUnit test suite to tag known-incompatible tests with the existing TrimmableTypeMapUnsupported category, so CoreCLR “trimmable typemap” runs can filter them out without changing the underlying runtime behavior.
Changes:
- Mark
JniValueMarshalerContractTests<T>(and thus all derived contract fixtures in that file) withCategory ("TrimmableTypeMapUnsupported"). - Mark
JniPeerMembersTests.VirtualInvokeOnBaseInvokesMostDerivedJavaMethodwithCategory ("TrimmableTypeMapUnsupported")for follow-up investigation.
Show a summary per file
| File | Description |
|---|---|
| tests/Java.Interop-Tests/Java.Interop/JniValueMarshalerContractTests.cs | Adds TrimmableTypeMapUnsupported category to the value marshaler contract base class to enable exclusion during trimmable typemap runs. |
| tests/Java.Interop-Tests/Java.Interop/JniPeerMembersTests.cs | Tags a currently failing test with TrimmableTypeMapUnsupported to exclude it from trimmable typemap runs. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
jonathanpeppers
approved these changes
Jun 18, 2026
JavaObjectArray<object> currently depends on JavaProxyObject semantics for plain managed object round-tripping. The trimmable typemap value manager falls back to Android.Runtime.JavaObject instead, so exclude these contract tests until JavaProxyObject support is investigated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Clean up unrelated blank-line noise from the trimmable typemap test exclusion diff. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context from dotnet/android PR dotnet/android#11617: CoreCLR trimmable typemap runs fail tests that depend on unsupported reflection/value-marshaler behavior.
This marks the following tests as
TrimmableTypeMapUnsupported:JniValueMarshalerContractTests<T>: these directly test the reflection-based value marshaler APIs. The trimmable typemap runtime intentionally throws ifGetValueMarshalerCore()is called.JniPeerMembersTests.VirtualInvokeOnBaseInvokesMostDerivedJavaMethod: this still unexpectedly reachesGetValueMarshalerCore<T>()through the test helper constructor path; it should be fixed separately.JavaObjectArray_object_ContractTest: these inherited collection/list contract tests depend on plain managedobjectvalues round-tripping throughJavaProxyObject. The trimmable value manager currently falls back toJavaConvert.ToLocalJniHandle(value), which wraps plain objects asAndroid.Runtime.JavaObject(mono/android/runtime/JavaObject) instead ofJava.Interop.JavaProxyObject(net/dot/jni/internal/JavaProxyObject).Tracking issue for the JavaProxyObject/trimmable typemap support gap: dotnet/android#11703.
Validation:
dotnet build external/Java.Interop/tests/Java.Interop-Tests/Java.Interop-Tests.csproj --no-restore --verbosity:minimal-p:PublishReadyToRun=false: after these exclusions, the run drops to 2 failures (TrimmableTypeMapTypeManagerTests.JavaProxyObject_ObjectMethodsUseJavaIdentitySemanticsin dotnet/android andJniTypeManagerTests.GetType, which is unrelated to JavaProxyObject object-array contracts).