Repository navigation
Closed
Labels
area-NativeAOT-coreclrdisabled-testThe test is disabled in source code against the issueThe test is disabled in source code against the issueos-android
Milestone
Description
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.
Metadata
Metadata
Assignees
Labels
area-NativeAOT-coreclrdisabled-testThe test is disabled in source code against the issueThe test is disabled in source code against the issueos-android
Type
Projects
- StatusShow more project fieldsNo status
Activity
dotnet-policy-service commentedon Oct 21, 2025
Tagging subscribers to 'arch-android': @vitek-karas, @simonrozsival, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Oct 21, 2025
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.
BrzVlad commentedon Oct 23, 2025
cc @simonrozsival @grendello
simonrozsival commentedon Oct 27, 2025
@sbomer it appears that the
Java_net_dot_android_crypto_DotnetProxyTrustManager_verifyRemoteCertificatemethod, which is inlibSystem.Security.Cryptography.Native.Android.sofile is not available at runtime. The native library needs to be manually loaded at startup through Java (or JNI) call toSystem.loadLibrary("libSystem.Security.Cryptography.Native.Android.so")just as we do it inApkBuilder.cs.Merge origin/main into Android NativeAOT JNI fix
Merge origin/main into Android NativeAOT JNI fix
sbomer commentedon Jul 1, 2026
Fixed by #129872.