Repository navigation
Conversation
Use the Android app library handle when resolving exported NativeAOT test entry points, while preserving GetMainProgramHandle for other platforms. Co-authored-by: Copilot App <[email protected]> Assisted-by: Copilot CLI:gpt-5.5
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
There was a problem hiding this comment.
Pull request overview
This change updates the NativeAOT TrimmingBehaviors smoke test to resolve unmanaged exports from a different module handle on Android, rather than always using NativeLibrary.GetMainProgramHandle(). This effectively re-enables the Android code path for UnmanagedCallersOnlyAssociatedSourceType by loading the app/library module on Android and using that handle for export lookup.
Changes:
- Removed the Android early-return skip so the test executes on Android again.
- Introduced
GetExportOwnerHandle()to useNativeLibrary.Load(...)on Android while preservingGetMainProgramHandle()on other platforms.
Show a summary per file
| File | Description |
|---|---|
| src/tests/nativeaot/SmokeTests/TrimmingBehaviors/UnmanagedCallersOnlyAssociatedSourceType.cs | Re-enables the Android test path and changes export lookup to use an Android-appropriate module handle. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
|
|
||
| Assembly assembly = typeof(UnmanagedCallersOnlyAssociatedSourceType).Assembly; | ||
| string libraryName = assembly.GetName().Name!; | ||
| return NativeLibrary.Load(libraryName, assembly, searchPath: null); | ||
| } |
MichalStrehovsky
left a comment
There was a problem hiding this comment.
If we were to load the .so with native AOT bits using RTLD_GLOBAL, the NativeLibrary.GetMainProgramHandle would probably work as-is (this is not the only test using it, we just do very little testing on Android).
|
Workflow state for the Holistic Review Orchestrator. {
"version": 5,
"last_dispatched_commit": "44d48431960a190420875fd700bec73a62dea098",
"last_dispatched_base_ref": "main",
"last_dispatched_base_sha": "1ab7d0535812a71e3c95c70761fcf1af49511e51",
"last_reviewed_commit": "44d48431960a190420875fd700bec73a62dea098",
"last_reviewed_base_ref": "main",
"last_reviewed_base_sha": "1ab7d0535812a71e3c95c70761fcf1af49511e51",
"last_recorded_worker_run_id": "29682984780",
"review_attempt_commit": "",
"review_attempt_base_ref": "",
"review_attempt_count": 0,
"max_review_attempts": 5,
"review_history_format": "holistic-review-disclosure-v1",
"review_history": [
{
"commit": "44d48431960a190420875fd700bec73a62dea098",
"review_id": 4730585457
}
]
} |
There was a problem hiding this comment.
Holistic Review
Motivation: The NativeAOT TrimmingBehaviors smoke test UnmanagedCallersOnlyAssociatedSourceType was disabled on Android (ActiveIssue #129366) because NativeLibrary.GetMainProgramHandle() did not resolve the [UnmanagedCallersOnly(EntryPoint=...)] exports there. On Android, NativeAOT compiles the app into a shared library rather than the main program, so the exports live in that .so, not in the main program handle, producing EntryPointNotFoundException.
Approach: The fix removes the Android early-return and introduces GetExportOwnerHandle(), which keeps GetMainProgramHandle() on other platforms but on Android loads the app's own library by its assembly name via NativeLibrary.Load(libraryName, assembly, searchPath: null). This is a minimal, platform-scoped change that re-enables real coverage instead of returning success unconditionally, which is the right approach. The author reports verifying return-code=100 on Android arm64 under instrumentation.
Summary: ✅ LGTM. Test-only change that re-enables previously skipped Android coverage by resolving exports from the correct library handle. The logic is clear and correctly gated per-platform; the loaded handle is intentionally left unreleased, which is acceptable for a short-lived smoke test. No blocking concerns.
Note
This review was generated by this repository's Holistic Review agentic workflow to complement the built-in Copilot review.
Generated by Holistic Review · 42 AIC · ⌖ 15.2 AIC · ⊞ 10K
Fixes #129366
Summary
UnmanagedCallersOnlyAssociatedSourceTypein the NativeAOTTrimmingBehaviorssmoke test.NativeLibrary.GetMainProgramHandle()on other platforms.Testing
./build.sh clr+libs -lc release -rc checkedTrimmingBehaviorsexecutable onosx.arm64.CheckedTrimmingBehaviorsAPK under instrumentation (return-code=100)Note
This PR description was created with assistance from GitHub Copilot.