[CoreCLR] Remove native runtime linking p/invoke override#12025
Merged
simonrozsival merged 5 commits intoJul 9, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the unused CoreCLR “native runtime linking” p/invoke override implementation (the unified-DSO pinvoke-override-dynamic path) and makes CoreCLR builds fail fast if _AndroidEnableNativeRuntimeLinking=true is manually enabled, preventing a dead/unsupported configuration from being used.
Changes:
- Adds an MSBuild validation error when
_AndroidEnableNativeRuntimeLinking=trueunder CoreCLR. - Removes the CoreCLR
pinvoke-override-dynamicnative implementation and its CMake target. - Stops selecting/packing the removed
libpinvoke-override-dynamic-*.aarchives and cleans up a now-stale explanatory comment.
Show a summary per file
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets | Adds CoreCLR validation target to error out when native runtime linking is enabled; adjusts defaulting behavior to avoid silently overriding user-set values. |
| src/Xamarin.Android.Build.Tasks/Utilities/NativeRuntimeComponents.cs | Removes the dynamic pinvoke override archive from the unified-runtime archive selection list. |
| src/native/clr/pinvoke-override/precompiled.cc | Removes a stale comment referencing the removed unified-DSO dynamic override path. |
| src/native/clr/pinvoke-override/dynamic.cc | Deletes the dynamic override implementation source (no longer supported/used). |
| src/native/clr/pinvoke-override/CMakeLists.txt | Removes the pinvoke-override-dynamic library target and associated source list. |
| build-tools/create-packs/Microsoft.Android.Runtime.proj | Stops packing libpinvoke-override-dynamic-*.a assets into the CoreCLR runtime pack. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Merged
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jonathanpeppers
approved these changes
Jul 9, 2026
simonrozsival
added a commit
that referenced
this pull request
Jul 9, 2026
## Goal Remove the obsolete `logcat-parse` diagnostic tool from Java.Interop and dotnet/android packaging. ## Motivation `logcat-parse` is not part of the Android app runtime or normal app build path, but keeping it in `Java.Interop.sln` means CI restores and builds it during Java.Interop preparation. It depends on `Mono.Terminal`, and PR #12025 hit a red CI lane when `prepare java.interop Release` timed out restoring that package from the Azure DevOps feed: ```text NU1301: Failed to retrieve information about 'Mono.Terminal' The HTTP request ... has timed out after 100000ms. ``` Removing the unused tool removes that restore dependency and the associated CI flake surface. ## Summary - delete `external/Java.Interop/tools/logcat-parse` - delete `external/Java.Interop/tests/logcat-parse-Tests` - remove `logcat-parse` projects from `Java.Interop.sln` and `Xamarin.Android.sln` - remove the Java.Interop CI test entry for `logcat-parse-Tests` - remove `Mono.Terminal` and `Mono.CSharp` package-version pins that were only used by `logcat-parse` - stop packaging `logcat-parse.exe`, `logcat-parse.pdb`, and `Mono.CSharp.dll` in legacy installers - update docs and test catalog references
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.
Goal
Remove the unused CoreCLR app-build-time dynamic native-runtime-linking / dynamic p/invoke override path.
Background
This path was introduced for CoreCLR only:
_AndroidEnableNativeRuntimeLinking, importedMicrosoft.Android.Sdk.NativeRuntime.targetsfor CoreCLR, wired_LinkNativeRuntimeinto the CoreCLR build order, and added the generatedpinvoke_preserve.*.ll/pinvoke-override-dynamicmachinery.The original purpose was to build a unified runtime DSO during the app build by statically linking the CoreCLR runtime pack, BCL native archives, and .NET for Android native runtime pieces together. In that layout, runtime/BCL native symbols were hidden inside the unified DSO, so CoreCLR could not use the normal separate-library resolution path. The dynamic p/invoke override generated app-specific lookup/preservation tables so those linked-in symbols could still be resolved and kept alive.
That support was never wired for MonoVM or NativeAOT.
_AndroidEnableNativeRuntimeLinkingis also an internal property, so this PR removes the dead CoreCLR implementation and stops defaulting/validating the internal knob instead of preserving an unsupported build error path.Why remove it now
CoreCLR now uses the default separate-
.soruntime layout with the precompiled p/invoke override path. In #11537, the precompiled path stopped serving BCL native library p/invokes from a hand-maintained static table and lets CoreCLR resolve those symbols itself from the standalone BCL.sofiles.That means the dynamic unified-DSO path no longer buys us anything: it keeps extra generated/native code alive, carries symbol-table drift risk, and was only ever usable for the CoreCLR experiment it was added for.
Summary
pinvoke-override-dynamicnative target anddynamic.cclibpinvoke-override-dynamic-*.aarchive_AndroidEnableNativeRuntimeLinking_AndroidEnableNativeRuntimeLinking=truevalidation errorValidation
git diff --checkgit grep -n "pinvoke-override-dynamic\|dynamic.cc\|XA_PINVOKE_OVERRIDE_DYNAMIC\|LIB_NAME_DYNAMIC" -- ':!src/native/mono/**' ':!bin/**'returned no tracked CoreCLR references