[ci-fix] Fix Android NativeAOT template for updated memory safety rules - #134323
Closed
simonrozsival wants to merge 1 commit into
Closed
simonrozsival wants to merge 1 commit into
simonrozsival wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Updates the Android NativeAOT template for revised C# memory-safety rules.
Changes:
- Scopes JNI and pointer operations in
unsafeblocks. - Marks pointer-bearing native declarations
unsafe. - Removes obsolete type-level
unsafemodifiers.
| File | Description |
|---|---|
src/tasks/AndroidAppBuilder/Templates/monodroid-nativeaot.cs |
Applies updated unsafe-context and interop safety annotations. |
Member
Author
This was referenced Sep 21, 2026
This was referenced Sep 21, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
unsafemodifiers that are invalid under the updated C# memory-safety rulesunsafeblocks around JNI and native interop operationsunsafeand document their caller safety contractsThis is closely related to #134134, which fixed the equivalent Apple NativeAOT build break. The Apple imports were correctly marked
safebecause they synchronously copy managed string inputs and impose no obligation on callers. The Android imports remainunsafebecause the native implementations dereference or retain the suppliedJavaVM*andargvpointers.@matouskozak noticed the Android failure in runtime-extra-platforms build 1604366.
Validation
./build.sh tasks/p:StripSymbols=falsebecause the local environment does not havellvm-objcopySystem.Text.Json.SourceGeneration.Roslyn3.11.TestsandSystem.Text.Json.SourceGeneration.Roslyn4.4.TestsNote
This pull request description was generated with GitHub Copilot.