Repository navigation
[native] Remove unused C++ helpers - #13341
Conversation
Remove the unreferenced custom string implementation and HostUtil helper, along with unused mapping, DSO loading, filesystem, search, JNI wrapper, and C++ utility helpers. Remove obsolete build and include references. Keep the active RuntimeUtil, path-based DSO loading, and stateless lower_bound implementations unchanged. Include <functional> directly for the remaining std::invoke usage instead of relying on <memory>. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the removal of unused native runtime helpers.
No open issues 🎉
What changed in this PR
Removes unused C++ helpers from the .NET for Android native runtime, reducing maintenance overhead without intentionally changing runtime behavior or exported entry points.
Changes:
- Deletes the custom string implementation, duplicate
HostUtil, and unused filesystem, APK mapping, search, and JNI helpers. - Removes obsolete CMake and include references; adds
<functional>directly forstd::invoke. - Preserves active
RuntimeUtil, path-based DSO loading, and statelessSearch::lower_bound.
| File | Description |
|---|---|
src/native/common/include/shared/cpp-util.hh |
Removes unused utilities and directly includes <functional>. |
src/native/common/include/runtime-base/strings.hh |
Deletes the unused custom string implementation. |
src/native/common/include/runtime-base/search.hh |
Removes unused search overloads. |
src/native/common/include/runtime-base/jni-wrappers.hh |
Removes unused hasValue(). |
src/native/common/include/runtime-base/dso-loader.hh |
Removes descriptor-based DSO loading. |
src/native/clr/runtime-base/util.cc |
Removes unused filesystem helper implementations. |
src/native/clr/include/runtime-base/util.hh |
Removes unused declarations, mapping helpers, and supporting state. |
src/native/clr/include/host/host-util.hh |
Deletes the unused HostUtil declaration. |
src/native/clr/host/host.cc |
Removes the obsolete HostUtil include. |
src/native/clr/host/host-util.cc |
Deletes the unused HostUtil implementation. |
src/native/clr/host/CMakeLists.txt |
Removes host-util.cc from the build sources. |
Review effort: Balanced
|
/review |
|
✅ Android PR Reviewer completed successfully!
|
There was a problem hiding this comment.
✅ LGTM — no actionable code findings
Findings: 0 errors, 0 warnings, 0 suggestions.
Reviewed all 11 changed files, including the complete deleted implementations, and checked remaining callers and build references. The removed helpers have no remaining consumers in the checked-out tree. The active RuntimeUtil implementation, path-based DSO loading, and stateless Search::lower_bound() remain unchanged. Removing host-util.cc from CMake alongside its implementation is consistent, and replacing <memory> with <functional> supplies the direct dependency for the retained std::invoke usage. This supports the stated no-behavior-change intent.
CI: All 42 GitHub checks for the PR head report success, including the aggregate dotnet-android check for Azure build 1655983. Direct Azure build/timeline verification could not be completed: the build query required authentication, and the timeline query failed during CLI initialization. Pipeline internals and non-gating test results were therefore not independently verified. No local builds or device tests were run as part of this review.
No inline comments were added because this mechanical dead-code cleanup revealed no actionable concern on the changed lines.
Generated by Android PR Reviewer for #13341 · copilot · gpt61 · 26.2 AIC · ⌖ 4.25 AIC · ⊞ 20K
Comment /review to run again
|
@dalexsoto review |
dalexsoto
left a comment
There was a problem hiding this comment.
Reviewed the complete native-helper removal, retained JNI/search/DSO consumers, native build routing, exports and affected target integration. No blocking issues found. This was a read-only source review.
Context: #10385
Investigating whether
xamarin_getifaddrs.ccwas still needed showed that it had already been removed along with the obsoleteSystem.AndroidPlatformhooks. A follow-up audit found other native code which has outlived its callers.strings.hhis no longer included anywhere, and its custom string types have no remaining consumers.HostUtil::get_class_from_runtime_field()is still compiled, but both callers use the equivalentRuntimeUtilimplementation. The APK mapping helpers and descriptor-basedDsoLoader::load()overload are also unused: assembly-store discovery now usesdlopen()/dlsym(), and current DSO loading uses paths rather than APK file descriptors and offsets.Remove these implementations and their build/include references, along with the unused filesystem helpers, search overloads, JNI wrapper accessor, and C++ utility templates. Keep the active
RuntimeUtil, path-based DSO loader, and statelessSearch::lower_bound()unchanged. Replace the removed utilities'<memory>include with<functional>for the remainingstd::invokeusage.No exported entry points are removed, and no runtime behavior change is intended.
Validation
Local SDK/native builds on macOS:
make prepare— passed.make all— initially blocked by the missing Android CMake 4.1.2 executable. Retrying with-p:AndroidCmakeVersionPath=3.30.3exposed the old Ninja path in the generated presets; regenerated the ignored localsrc/native/CMakePresets.jsonto pick up the override. No toolchain configuration changes are committed../dotnet-local.sh build src/native/native-clr.csproj --no-restore -p:AndroidCmakeVersionPath=3.30.3 -v minimal— passed; native Debug/Release for armeabi-v7a, arm64-v8a, and x86_64../dotnet-local.sh build src/native/native-nativeaot.csproj --no-restore -p:AndroidCmakeVersionPath=3.30.3 -v minimal— passed; the same native configurations and ABIs.make leeroy MSBUILD_ARGS='-p:AndroidCmakeVersionPath=3.30.3'— passed, including extra API levels and local workload configuration../dotnet-local.sh test src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj --no-build --filter 'FullyQualifiedName~NativeAotSystemPropertiesTests' -v minimal— passed, 18 tests.CoreCLR Debug on the ARM64 emulator — build/install passed; 28 JavaList tests passed, none failed or skipped:
NativeAOT Release on the ARM64 emulator — build/install passed; 28 JavaList tests passed, none failed or skipped:
Native builds emitted integer-conversion warnings, and the NativeAOT test build emitted trim/AOT-analysis warnings; all completed without errors. Device coverage was limited to ARM64 and the JavaList category, not the full runtime suite.