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.
The System.Net.WebSockets.Client.Tests contain many failures on android nativeaot similar to the following:
The problem is that the Java method
DotnetProxyTrustManager.verifyRemoteCertificateis 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.