Repository navigation
[NativeAOT] Link runtime crypto archive directly - #12372
Merged
jonathanpeppers merged 1 commit intoAug 13, 2026
Merged
Conversation
Use the System.Security.Cryptography.Native.Android archive supplied by the SDK-resolved NativeAOT runtime pack instead of downloading and copying it into the Android runtime pack. Add an on-device AES round-trip test that runs in the NativeAOT lane. Co-authored-by: Copilot App <[email protected]> Copilot-Session: d4663df0-3e70-40ba-94f8-ffe73104f480
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the NativeAOT build/link pipeline to rely on the SDK-resolved NativeAOT runtime pack for libSystem.Security.Cryptography.Native.Android.a (instead of downloading/copying it into Microsoft.Android.Runtime.NativeAOT packs), and adds a device-level AES encrypt/decrypt round-trip test to validate the crypto archive is correctly linked in NativeAOT apps.
Changes:
- Add an on-device
AesEncryptDecryptRoundTriptest in the Mono.Android test app, categorized for NativeAOT crypto validation. - Remove the special-case MSBuild logic and pack-production steps that downloaded/copied
libSystem.Security.Cryptography.Native.Android.aintoMicrosoft.Android.Runtime.NativeAOTpacks. - Simplify workload provisioning by dropping explicit
PackageDownloadentries for the NativeAOT Android runtime packs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Mono.Android-Tests/Mono.Android-Tests/System.Security.Cryptography/CryptographyTest.cs | Adds AES encrypt/decrypt round-trip smoke test intended to validate NativeAOT crypto linking on-device. |
| tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj | Includes the new cryptography test source file in the test app build. |
| src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.NativeAOT.targets | Removes the explicit swap-in of the crypto archive from the Android runtime pack directory, relying on @(NativeLibrary) instead. |
| src/workloads/workloads.csproj | Stops pre-downloading the NativeAOT Android runtime packs as part of workload provisioning. |
| src/native/native.targets | Removes copying the crypto archive from the NativeAOT runtime pack into the Microsoft.Android.Runtime.NativeAOT pack output. |
| build-tools/create-packs/Microsoft.Android.Runtime.proj | Stops packaging the crypto archive into Microsoft.Android.Runtime.NativeAOT packs during pack creation. |
akoeplinger
approved these changes
Aug 13, 2026
jonathanpeppers
deleted the
jonathanpeppers-stop-copying-nativeaot-crypto
branch
August 13, 2026 22:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
libSystem.Security.Cryptography.Native.Android.adirectly from the SDK-resolved NativeAOT runtime packMicrosoft.Android.Runtime.NativeAOTpacksTesting
Mono.Android.NET-TestswithPublishAot=trueand the trimmable typemapAesEncryptDecryptRoundTripon a connected Android deviceAndroidCryptoNative_CipherCreate,AndroidCryptoNative_CipherUpdate, andAndroidCryptoNative_CipherFinalExare linked into the arm64 application shared library