Skip to content

[TrimmableTypeMap] Resolve all TrimmableIgnore, SSL, and Java.Interop-Tests exclusions #11099

Description

@simonrozsival

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:

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.JavaObjectTest
  • Java.InteropTests.InvokeVirtualFromConstructorTests
  • Java.InteropTests.JniPeerMembersTests
  • Java.InteropTests.JniTypeManagerTests
  • Java.InteropTests.JniValueMarshaler_object_ContractTests
  • Java.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 TrimmableIgnore category — all 3 tests pass
  • Remove SSL exclusion — 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

  1. added
    Area: CoreCLRIssues that only occur when using CoreCLR.
    copilot`copilot-cli` or other AIs were used to author this
    and removed
    needs-triageIssues that need to be assigned.
    on Apr 9, 2026
  2. added this to the .NET 11 milestone on Apr 9, 2026
  3. simonrozsival commented on May 25, 2026

    @simonrozsival
    MemberAuthor

    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 TrimmableIgnore category — all 3 tests pass / are re-enabled

    • Remove SSL exclusion — all SSL tests are no longer excluded from the CoreCLRTrimmable lane

      • The CoreCLRTrimmable package-test lane now builds with -p:_AndroidTypeMapImplementation=trimmable -p:UseMonoRuntime=false and does not add SSL to ExcludeCategories.
      • SSL categories still exist on the tests themselves, and NativeAOT still excludes SSL, but that is separate from this trimmable typemap issue.
    • Remove or reduce ExcludedTestNames — Java.Interop-Tests fixtures run without SIGABRT

      • This has been reduced substantially. The original Java.Interop exact-name exclusions listed in this issue are no longer present except for Java.InteropTests.InvokeVirtualFromConstructorTests.
      • Current trimmable ExcludedTestNames on origin/main are:
        • Java.InteropTests.InvokeVirtualFromConstructorTests
        • Xamarin.Android.RuntimeTests.CustomWidgetTests.InflateCustomView_ShouldNotLeakGlobalRefs
      • The Java.Interop exclusion inventory/follow-up is now tracked by [TrimmableTypeMap] Trimmable typemap test exclusions inventory #11170.
    • Full parity: trimmable CoreCLR passes all tests that legacy CoreCLR passes

      • Not done yet while the remaining exact-name exclusions exist.

    Plan to fully close this issue

    1. Decide the disposition for Java.InteropTests.InvokeVirtualFromConstructorTests.

    2. Investigate and fix Xamarin.Android.RuntimeTests.CustomWidgetTests.InflateCustomView_ShouldNotLeakGlobalRefs.

      • This is now the only remaining non-Java.Interop exact-name exclusion in the CoreCLRTrimmable runtime test instrumentation.
      • Reproduce with a Release CoreCLRTrimmable Mono.Android.NET-Tests run, compare against legacy CoreCLR, and inspect the custom view inflation/activation path for the leaked global ref.
    3. After those two exclusions are resolved or explicitly accepted as non-goals, remove the remaining ExcludedTestNames entries guarded by RuntimeFeature.TrimmableTypeMap.

    4. Run the full Mono.Android.NET-Tests CoreCLRTrimmable lane and compare against the normal CoreCLR lane. If there are no additional trimmable-only exclusions/failures, this issue can be closed.

  4. simonrozsival commented on May 25, 2026

    @simonrozsival
    MemberAuthor

    Decision update:

    • Java.InteropTests.InvokeVirtualFromConstructorTests should 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_ShouldNotLeakGlobalRefs is 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 from NUnitInstrumentation.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.

  5. locked and limited conversation to collaborators on Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: CoreCLRIssues that only occur when using CoreCLR.copilot`copilot-cli` or other AIs were used to author thistrimmable-type-map

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions