Repository navigation
[TrimmableTypeMap] Resolve all TrimmableIgnore, SSL, and Java.Interop-Tests exclusions #11099
Description
Summary
Several tests are excluded when running Mono.Android.NET-Tests with _AndroidTypeMapImplementation=trimmable. Each exclusion needs investigation and a proper fix to achieve full test parity with the legacy llvm-ir typemap.
TrimmableIgnore category (3 tests)
These tests pass with legacy CoreCLR but fail/behave differently with the trimmable typemap:
1. JnienvTest.NewOpenGenericTypeThrows
Status: Fix in progress — PR #11093 adds an IsGenericTypeDefinition guard in StartCreateInstance. Once merged, this test should be re-enabled.
2. JnienvTest.ActivatedDirectThrowableSubclassesShouldBeRegistered
Status: Fix in progress — PR #11094 adds ActivatePeerFromJavaConstructor which calls the matching managed ctor for ()V signatures. Once merged, this test should be re-enabled.
3. JavaObjectExtensionsTests.JavaCast_BaseToGenericWrapper
Status: Needs investigation. The test casts a JavaList to JavaList<object> using JavaCast. The trimmable typemap may not handle generic type casting correctly.
SSL category (~20 tests)
SSL tests (ServerCertificateCustomValidationCallback_*, HttpsShouldWork, etc.) are excluded with the SSL category. These need investigation — they may already be fixed by:
- PR [TrimmableTypeMap] Pass TargetType and InvokerType through JavaPeerProxy constructor #11092 (InvokerType Virtual) — fixes invoker type resolution for
IHostnameVerifierInvoker - PR [TrimmableTypeMap] Fix UCO constructor activations #11094 (UCO activation parity) — fixes activation for types like
AlwaysAcceptingHostnameVerifier
Once those PRs merge, re-run SSL tests with trimmable and remove the exclusion if they pass.
ExcludedTestNames (6 fixtures, ~42 tests)
These Java.Interop-Tests fixtures are excluded because they crash with SIGABRT (ClassNotFoundException) — the JCW Java classes for JavaObject subclasses are not generated by the trimmable build process:
Java.InteropTests.JavaObjectTestJava.InteropTests.InvokeVirtualFromConstructorTestsJava.InteropTests.JniPeerMembersTestsJava.InteropTests.JniTypeManagerTestsJava.InteropTests.JniValueMarshaler_object_ContractTestsJava.InteropTests.JavaExceptionTests.InnerExceptionIsNotAProxy
Root cause
These fixtures use JavaObject types (Java.Interop's direct JNI wrapper, not Java.Lang.Object). Their JCW Java classes (e.g., net.dot.jni.test.JavaDisposedObject) are generated by the standalone Java.Interop-Tests build and compiled into Mono.Android-Test-classes.jar. However, the trimmable JCW generator only processes Java.Lang.Object subclasses — JavaObject subclasses are outside the Android type map system.
Possible fix
Include the standalone Java.Interop JCW output in the trimmable APK build, or have the trimmable GenerateTrimmableTypeMap task also process JavaObject subclasses when detected in the test assembly.
Definition of done
- Remove
TrimmableIgnorecategory — all 3 tests pass - Remove
SSLexclusion — all SSL tests pass - Remove or reduce
ExcludedTestNames— Java.Interop-Tests fixtures run without SIGABRT - Full parity: trimmable CoreCLR passes all tests that legacy CoreCLR passes
Activity
[TrimmableTypeMap] Add trimmable [Export] and [ExportField] callback …
simonrozsival commentedon May 25, 2026
Status update from
origin/main(ec8c61e1b): several items in the original issue are already fixed or have moved to narrower follow-up tracking.Original checklist status
Remove
TrimmableIgnorecategory — all 3 tests pass / are re-enabledTrimmableIgnoreno longer appears onorigin/main.JnienvTest.NewOpenGenericTypeThrowsis enabled; the open-generic activation guard landed via [TrimmableTypeMap] Reject open generic JNI construction #11273 rather than the earlier closed [Mono.Android] Throw NotSupportedException for open generic type activation #11093.JnienvTest.ActivatedDirectThrowableSubclassesShouldBeRegisteredis enabled; UCO constructor activation fixes landed via [TrimmableTypeMap] Fix UCO constructor activations #11094 and later [TrimmableTypeMap] Fix UCO constructor activation #11275.JavaObjectExtensionsTests.JavaCast_BaseToGenericWrapperis enabled; JavaCast/JavaAs + container support landed via [TrimmableTypeMap] JavaCast/JavaAs + container support #11225.Remove
SSLexclusion — all SSL tests are no longer excluded from the CoreCLRTrimmable lane-p:_AndroidTypeMapImplementation=trimmable -p:UseMonoRuntime=falseand does not addSSLtoExcludeCategories.SSLcategories still exist on the tests themselves, and NativeAOT still excludesSSL, but that is separate from this trimmable typemap issue.Remove or reduce
ExcludedTestNames— Java.Interop-Tests fixtures run without SIGABRTJava.InteropTests.InvokeVirtualFromConstructorTests.ExcludedTestNamesonorigin/mainare:Java.InteropTests.InvokeVirtualFromConstructorTestsXamarin.Android.RuntimeTests.CustomWidgetTests.InflateCustomView_ShouldNotLeakGlobalRefsFull parity: trimmable CoreCLR passes all tests that legacy CoreCLR passes
Plan to fully close this issue
Decide the disposition for
Java.InteropTests.InvokeVirtualFromConstructorTests.NUnitInstrumentation.cssay this fixture depends on[JniAddNativeMethodRegistrationAttribute], which is unsupported by design under the trimmable typemap; [TrimmableTypeMap] Refuse [JniAddNativeMethodRegistrationAttribute] with XA4251 #11274 made this an explicit XA4251 error.[JniAddNativeMethodRegistrationAttribute]work under trimmable.Investigate and fix
Xamarin.Android.RuntimeTests.CustomWidgetTests.InflateCustomView_ShouldNotLeakGlobalRefs.Mono.Android.NET-Testsrun, compare against legacy CoreCLR, and inspect the custom view inflation/activation path for the leaked global ref.After those two exclusions are resolved or explicitly accepted as non-goals, remove the remaining
ExcludedTestNamesentries guarded byRuntimeFeature.TrimmableTypeMap.Run the full
Mono.Android.NET-TestsCoreCLRTrimmable lane and compare against the normal CoreCLR lane. If there are no additional trimmable-only exclusions/failures, this issue can be closed.simonrozsival commentedon May 25, 2026
Decision update:
Java.InteropTests.InvokeVirtualFromConstructorTestsshould remain permanently excluded for the trimmable typemap. This fixture depends on[JniAddNativeMethodRegistrationAttribute], which is unsupported by design under trimmable and now emits XA4251. We should treat this as a documented known limitation unless there is a customer request to implement a fully trimmable-compatible replacement path.Xamarin.Android.RuntimeTests.CustomWidgetTests.InflateCustomView_ShouldNotLeakGlobalRefsis not related to the trimmable typemap and should not be an exact-name trimmable exclusion. I opened [tests] Remove custom widget trimmable exclusion #11483 to remove it fromNUnitInstrumentation.cs. The test still has its normal test-level disposition, so any remaining global-ref-leak work should be handled independently of this trimmable typemap parity issue.[tests] Remove custom widget trimmable exclusion (#11483)