Skip to content

Commit dba007b

Browse files
[tests] Exclude value marshaler tests from trimmable typemap (#1478)
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 if `GetValueMarshalerCore()` is called. - `JniPeerMembersTests.VirtualInvokeOnBaseInvokesMostDerivedJavaMethod`: this still unexpectedly reaches `GetValueMarshalerCore<T>()` through the test helper constructor path; it should be fixed separately. - `JavaObjectArray_object_ContractTest`: these inherited collection/list contract tests depend on plain managed `object` values round-tripping through `JavaProxyObject`. The trimmable value manager currently falls back to `JavaConvert.ToLocalJniHandle(value)`, which wraps plain objects as `Android.Runtime.JavaObject` (`mono/android/runtime/JavaObject`) instead of `Java.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` - Local dotnet/android CoreCLR trimmable device run with `-p:PublishReadyToRun=false`: after these exclusions, the run drops to 2 failures (`TrimmableTypeMapTypeManagerTests.JavaProxyObject_ObjectMethodsUseJavaIdentitySemantics` in dotnet/android and `JniTypeManagerTests.GetType`, which is unrelated to JavaProxyObject object-array contracts). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 498ef9a commit dba007b

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

tests/Java.Interop-Tests/Java.Interop/JavaObjectArrayTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ public void ObjectArrayType ()
150150
}
151151

152152
[TestFixture]
153+
[Category ("TrimmableTypeMapUnsupported")]
153154
public class JavaObjectArray_object_ContractTest : JavaObjectArrayContractTest<object> {
154155
static readonly object a = new object ();
155156

@@ -185,4 +186,3 @@ public void ObjectArrayType ()
185186
}
186187
}
187188
}
188-

tests/Java.Interop-Tests/Java.Interop/JniPeerMembersTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public void Ctor_CanReferenceNonexistentType ()
1818
}
1919

2020
[Test]
21+
[Category ("TrimmableTypeMapUnsupported")]
2122
public void VirtualInvokeOnBaseInvokesMostDerivedJavaMethod ()
2223
{
2324
var registered = GetInstanceMethods (MyString._members.InstanceMethods);

tests/Java.Interop-Tests/Java.Interop/JniValueMarshalerContractTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
namespace Java.InteropTests {
1616

17+
[Category ("TrimmableTypeMapUnsupported")]
1718
public abstract class JniValueMarshalerContractTests<
1819
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
1920
T

0 commit comments

Comments
 (0)