Repository navigation
[native] Remove native Java.Interop support library - #13112
Merged
Merged
Conversation
The remaining symbol lookup wrapper only calls dlsym and allocates an error string. Its cross-platform loading helpers are unused by the Android runtimes and do not justify a separate native library. Resolve P/Invoke symbols directly with dlsym and dlerror, and report failures through the standard runtime logger. Keep Android-aware library loading and use the platform loader flags explicitly. Move logging categories into the native runtime, replace the last legacy logging calls, and remove the obsolete sources and build/pack wiring. Clean up stale archives during incremental builds. Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
It changes native P/Invoke resolution and runtime-pack contents across multiple runtimes without a full runtime test-suite run.
0 open findings
What changed in this PR
Removes the obsolete native Java.Interop support library, replacing its remaining symbol resolution with direct Android runtime APIs and cleaning associated build and packaging artifacts.
Changes:
- Resolve P/Invoke symbols directly using
dlsym/dlerror. - Move native logging categories into the runtime and replace legacy logging calls.
- Remove obsolete Java.Interop sources, dependencies, assets, and stale archives.
| File | Description |
|---|---|
.github/copilot-instructions.md |
Updates native logging guidance. |
Microsoft.Android.slnx |
Removes the obsolete project. |
build-tools/create-packs/Microsoft.Android.Runtime.proj |
Stops packaging Java.Interop archives. |
build-tools/debian-metadata/rules |
Removes the obsolete module exclusion. |
build-tools/scripts/java-interop.dllmap |
Deletes obsolete native mappings. |
external/Java.Interop/Java.Interop.slnx |
Removes the native project entry. |
external/Java.Interop/src/java-interop/CMakeLists.txt |
Deletes validation-library configuration. |
external/Java.Interop/src/java-interop/java-interop-dlfcn.cc |
Deletes cross-platform loader implementation. |
external/Java.Interop/src/java-interop/java-interop-dlfcn.h |
Deletes loader declarations. |
external/Java.Interop/src/java-interop/java-interop-logger.h |
Deletes legacy logging declarations. |
external/Java.Interop/src/java-interop/java-interop-util.cc |
Deletes platform conversion helpers. |
external/Java.Interop/src/java-interop/java-interop-util.h |
Deletes legacy utility helpers. |
external/Java.Interop/src/java-interop/java-interop.cc |
Deletes allocation wrappers. |
external/Java.Interop/src/java-interop/java-interop.csproj |
Deletes the obsolete native project. |
external/Java.Interop/src/java-interop/java-interop.h |
Deletes the native API header. |
external/Java.Interop/src/java-interop/java-interop.targets |
Deletes native validation targets. |
src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/NativeAotSystemPropertiesTests.cs |
Removes the obsolete include path. |
src/Mono.Android/Android.Runtime/LogCategories.cs |
Updates the synchronization reference. |
src/native/CMakeLists.txt |
Removes Java.Interop configuration. |
src/native/clr/host/CMakeLists.txt |
Removes the host link dependency. |
src/native/clr/host/fastdev-assemblies.cc |
Uses the current logging API. |
src/native/clr/host/host.cc |
Uses the current logging API. |
src/native/clr/include/host/pinvoke-override-impl.hh |
Implements direct symbol resolution. |
src/native/clr/include/runtime-base/monodroid-dl.hh |
Removes the wrapper-based symbol lookup. |
src/native/clr/runtime-base/android-system.cc |
Removes obsolete Java.Interop includes. |
src/native/clr/shared/CMakeLists.txt |
Removes include and link dependencies. |
src/native/clr/shared/log_functions.cc |
Removes legacy logger implementations. |
src/native/common/include/shared/helpers.hh |
Uses runtime-owned logging categories. |
src/native/common/include/shared/log_categories.hh |
Defines native logging categories. |
src/native/common/include/shared/log_functions.hh |
Includes the new category header. |
src/native/common/java-interop/CMakeLists.txt |
Deletes the obsolete static-library target. |
src/native/native.targets |
Removes inputs and cleans stale archives. |
src/native/nativeaot/host/CMakeLists.txt |
Removes the NativeAOT link dependency. |
🧠 Review effort: Balanced
jonathanpeppers
approved these changes
Oct 13, 2026
21 of 23 tasks
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.
The remaining native Java.Interop symbol lookup wrapper only calls
dlsymand allocates an error string. Its unused cross-platform loading helpers are unnecessary for the Android runtimes.Resolve P/Invoke symbols directly with
dlsym/dlerrorand report failures throughlog_errorf, without allocating error strings. Preserve Android-aware library loading and useRTLD_NOW | RTLD_LOCALexplicitly.Move logging categories into the native runtime, replace the last legacy logging calls, and remove the obsolete sources, solution entries, CMake dependencies, and runtime-pack assets. Incremental builds also remove stale Java.Interop archives.
Local validation
make prepare CONFIGURATION=Releasemake all CONFIGURATION=ReleaseBuildExtraApiLevels./dotnet-local.sh build src/native/native-clr.csproj -c Release --no-restore -v:minimal && ./dotnet-local.sh build src/native/native-nativeaot.csproj -c Release --no-restore -v:minimalJAVA_HOME=$(/usr/libexec/java_home) ./dotnet-local.sh test bin/TestRelease/net11.0/Microsoft.Android.Build.Tasks.Tests.dll --filter FullyQualifiedName~NativeAotSystemPropertiesTestsgit diff --cached --checkOn an arm64 API 36 emulator, three focused P/Invoke checks passed on each of CoreCLR and NativeAOT, covering library loading, repeated symbol resolution, and a missing entry point followed by a successful native call. The two temporary new tests and their category were removed after validation, as requested; no new tests are included in this PR. Logcat confirmed the standard logger's missing-symbol diagnostic.
A temporary MSBuild harness verified stale-archive cleanup and active-library copying for both runtimes with absolute and relative output paths. Binary inspection confirmed that the removed native API definitions and obsolete runtime-pack archives are absent. The full runtime test suite was not run.
Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include:No linked issue. No new unit tests, as requested; local validation is recorded above.