Skip to content

[NAOT][android] System.Net.WebSockets.Client.Tests failure #120959

Description

@sbomer

The System.Net.WebSockets.Client.Tests contain many failures on android nativeaot similar to the following:

10-21 11:51:27.963 21946 21969 E ts.Client.Tests: No implementation found for boolean net.dot.android.crypto.DotnetProxyTrustManager.verifyRemoteCertificate(long) (tried Java_net_dot_android_crypto_DotnetProxyTrustManager_verifyRemoteCertificate and Java_net_dot_android_crypto_DotnetProxyTrustManager_verifyRemoteCertificate__J) - is the library loaded, e.g. System.loadLibrary?
        10-21 11:51:27.963 21946 21969 W System.err: java.lang.UnsatisfiedLinkError: No implementation found for boolean net.dot.android.crypto.DotnetProxyTrustManager.verifyRemoteCertificate(long) (tried Java_net_dot_android_crypto_DotnetProxyTrustManager_verifyRemoteCertificate and Java_net_dot_android_crypto_DotnetProxyTrustManager_verifyRemoteCertificate__J) - is the library loaded, e.g. System.loadLibrary?
        10-21 11:51:27.963 21946 21969 W System.err: 	at net.dot.android.crypto.DotnetProxyTrustManager.verifyRemoteCertificate(Native Method)
        10-21 11:51:27.963 21946 21969 W System.err: 	at net.dot.android.crypto.DotnetProxyTrustManager.checkServerTrusted(DotnetProxyTrustManager.java:32)
        10-21 11:51:27.963 21946 21969 W System.err: 	at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:290)
        10-21 11:51:27.963 21946 21969 W System.err: 	at com.android.org.conscrypt.ConscryptEngine.verifyCertificateChain(ConscryptEngine.java:1635)
        10-21 11:51:27.964 21946 21969 W System.err: 	at com.android.org.conscrypt.NativeCrypto.ENGINE_SSL_read_direct(Native Method)
        10-21 11:51:27.964 21946 21969 W System.err: 	at com.android.org.conscrypt.NativeSsl.readDirectByteBuffer(NativeSsl.java:574)
        10-21 11:51:27.964 21946 21969 W System.err: 	at com.android.org.conscrypt.ConscryptEngine.readPlaintextDataDirect(ConscryptEngine.java:1092)
        10-21 11:51:27.964 21946 21969 W System.err: 	at com.android.org.conscrypt.ConscryptEngine.readPlaintextDataHeap(ConscryptEngine.java:1112)
        10-21 11:51:27.964 21946 21969 W System.err: 	at com.android.org.conscrypt.ConscryptEngine.readPlaintextData(ConscryptEngine.java:1084)
        10-21 11:51:27.964 21946 21969 W System.err: 	at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:873)
        10-21 11:51:27.964 21946 21969 W System.err: 	at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:744)
        10-21 11:51:27.964 21946 21969 W System.err: 	at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:709)
        10-21 11:51:27.964 21946 21969 W System.err: 	at com.android.org.conscrypt.Java8EngineWrapper.unwrap(Java8EngineWrapper.java:237)     

The problem is that the Java method DotnetProxyTrustManager.verifyRemoteCertificate is implemented in the native crypto shim, which is a static library when using nativeaot. When the static library gets linked into the app's shared object, this symbol is removed (because it's only used dynamically from JNI).

For managed code, such symbols are normally annotated with UnmanagedCallersOnly, and ILC can write a linker script that exports these symbols in the .so.

Activity

  1. dotnet-policy-service commented on Oct 21, 2025

    @dotnet-policy-service
    Contributor

    Tagging subscribers to 'arch-android': @vitek-karas, @simonrozsival, @steveisok, @akoeplinger
    See info in area-owners.md if you want to be subscribed.

  2. dotnet-policy-service commented on Oct 21, 2025

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
    See info in area-owners.md if you want to be subscribed.

  3. BrzVlad commented on Oct 23, 2025

    @BrzVlad
    Member
  4. removed
    untriagedNew issue has not been triaged by the area owner
    on Oct 23, 2025
  5. added this to the 11.0.0 milestone on Oct 23, 2025
  6. simonrozsival commented on Oct 27, 2025

    @simonrozsival
    Member

    @sbomer it appears that the Java_net_dot_android_crypto_DotnetProxyTrustManager_verifyRemoteCertificate method, which is in libSystem.Security.Cryptography.Native.Android.so file is not available at runtime. The native library needs to be manually loaded at startup through Java (or JNI) call to System.loadLibrary("libSystem.Security.Cryptography.Native.Android.so") just as we do it in ApkBuilder.cs.

  7. added
    disabled-testThe test is disabled in source code against the issue
    on Nov 5, 2025
  8. sbomer commented on Jul 1, 2026

    @sbomer
    MemberAuthor

    Fixed by #129872.

  9. locked and limited conversation to collaborators on Aug 1, 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

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions