Skip to content

Fix Android NativeAOT test crypto JNI export#129872

Open
sbomer wants to merge 1 commit into
dotnet:mainfrom
sbomer:sbomer-investigate-android-naot-websockets
Open

Fix Android NativeAOT test crypto JNI export#129872
sbomer wants to merge 1 commit into
dotnet:mainfrom
sbomer:sbomer-investigate-android-naot-websockets

Conversation

@sbomer

@sbomer sbomer commented Jun 25, 2026

Copy link
Copy Markdown
Member

Fix Android NativeAOT test APK packaging so the Android crypto trust-manager JNI callback is both retained and exported from the final app shared library.

This also removes the issue 120959 Android NativeAOT test exclusions for System.Net.Requests.Tests and System.Net.WebSockets.Client.Tests.

For customer Android NativeAOT apps, the proper fix lives in dotnet/android’s NativeAOT packaging/linking path: it already models libSystem.Security.Cryptography.Native.Android.a with jniOnLoadName: AndroidCryptoNative_InitLibraryOnLoad and SymbolsToPreserve for Java_net_dot_android_crypto_DotnetProxyTrustManager_verifyRemoteCertificate; the Android workload should flow that metadata into the final app link/export. This runtime change is scoped to runtime test APK packaging only.

Note

This pull request description was created with assistance from GitHub Copilot.

Keep the Android crypto trust-manager JNI callback rooted and exported for runtime NativeAOT test APKs, and re-enable the tests disabled for the missing export.

Assisted-by: Copilot:gpt-5.5

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Android NativeAOT test app build settings to ensure the crypto trust-manager JNI callback symbol is retained and exported from the final shared library, and re-enables previously excluded Android NativeAOT test projects.

Changes:

  • Add NativeAOT IlcArg / linker args for exporting + forcing inclusion of Java_net_dot_android_crypto_DotnetProxyTrustManager_verifyRemoteCertificate in Android test builds.
  • Remove Android NativeAOT ProjectExclusions for System.Net.Requests.Tests and System.Net.WebSockets.Client.Tests.
Show a summary per file
File Description
src/libraries/tests.proj Removes Android NativeAOT test exclusions for System.Net.Requests and System.Net.WebSockets.Client test projects.
eng/testing/tests.android.targets Adds NativeAOT export/undefined-symbol linker arguments so the crypto JNI trust-manager callback is retained and exported in test APKs.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment thread eng/testing/tests.android.targets
@sbomer

sbomer commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

/azp run runtime-android

@sbomer

sbomer commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

/azp run runtime-androidemulator

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants