Skip to content

Remove unused nativeImagePath from assembly LoadFromPath paths#129597

Open
elinor-fung wants to merge 1 commit into
dotnet:mainfrom
elinor-fung:remove-loadfrompath-nipath
Open

Remove unused nativeImagePath from assembly LoadFromPath paths#129597
elinor-fung wants to merge 1 commit into
dotnet:mainfrom
elinor-fung:remove-loadfrompath-nipath

Conversation

@elinor-fung

@elinor-fung elinor-fung commented Jun 18, 2026

Copy link
Copy Markdown
Member

The native image (NI) path is a vestige of NGEN, which CoreCLR no longer supports. It was already ignored on every runtime:

  • The CoreCLR AssemblyNative_LoadFromPath QCall ignored pwzNIPath.
  • Mono dropped it with a // TODO: Handle nativeImagePath.
  • NativeAot threw PlatformNotSupportedException.

This removes pwzNIPath from the QCall and drops the nativeImagePath parameter from InternalLoadFromPath.

cc @dotnet/appmodel @AaronRobinsonMSFT

Note

This PR description was generated with the assistance of GitHub Copilot.

The native image (NI) path is a vestige of NGEN, which CoreCLR no longer supports. It was already ignored on every runtime: the CoreCLR AssemblyNative_LoadFromPath QCall ignored pwzNIPath, Mono dropped it with a TODO, and NativeAot threw PlatformNotSupportedException.

Remove pwzNIPath from the QCall and drop the now-unused nativeImagePath parameter from InternalLoadFromPath across CoreCLR, Mono, and NativeAot. The public LoadFromNativeImagePath API is unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @elinor-fung
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the unused “native image” path parameter from the internal AssemblyLoadContext LoadFromPath plumbing across CoreCLR, Mono, and NativeAOT, including updating the CoreCLR QCall signature accordingly.

Changes:

  • Remove the nativeImagePath parameter from InternalLoadFromPath and update all call sites to pass only assemblyPath.
  • Update CoreCLR’s AssemblyNative_LoadFromPath QCall declaration/definition and its managed LibraryImport signature to drop the NI-path argument.
  • Simplify Mono’s implementation by removing the now-unneeded warning suppression and TODO related to the unused parameter.
Show a summary per file
File Description
src/mono/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.Mono.cs Drops unused nativeImagePath parameter from Mono’s InternalLoadFromPath.
src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs Updates LoadFromAssemblyPath / LoadFromNativeImagePath to call the 1-arg InternalLoadFromPath.
src/coreclr/vm/assemblynative.hpp Updates QCall prototype for AssemblyNative_LoadFromPath to remove NI-path parameter.
src/coreclr/vm/assemblynative.cpp Updates QCall implementation signature for AssemblyNative_LoadFromPath accordingly.
src/coreclr/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.CoreCLR.cs Updates managed LibraryImport for AssemblyNative_LoadFromPath and CoreCLR InternalLoadFromPath.
src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.NativeAot.cs Drops unused nativeImagePath parameter from NativeAOT stub InternalLoadFromPath.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 1

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants