Skip to content

Use DllImportSearchPath.AssemblyDirectory for loading jitinterface library - #119287

Merged
elinor-fung merged 1 commit into
dotnet:mainfrom
elinor-fung:issue118999
Sep 3, 2025
Merged

Use DllImportSearchPath.AssemblyDirectory for loading jitinterface library#119287
elinor-fung merged 1 commit into
dotnet:mainfrom
elinor-fung:issue118999

Conversation

@elinor-fung

@elinor-fung elinor-fung commented Sep 2, 2025

Copy link
Copy Markdown
Member

DllImportSearchPath.ApplicationDirectory doesn't mean anything on non-Windows. Switch to using DllImportSearchPath.AssemblyDirectory, which will search next to the specified assembly or next to the application for single-file applications.

See #118999

Copilot AI review requested due to automatic review settings September 2, 2025 21:10

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 fixes a cross-platform issue with loading the jitinterface library by changing the DLL search path from ApplicationDirectory to AssemblyDirectory. The change ensures proper library loading on non-Windows platforms where ApplicationDirectory is not meaningful.

  • Updated the DllImportSearchPath parameter to use AssemblyDirectory instead of ApplicationDirectory

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@elinor-fung
elinor-fung requested a review from jkotas September 2, 2025 21:11

@jkotas jkotas 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.

Thanks!

@jkotas

jkotas commented Sep 2, 2025

Copy link
Copy Markdown
Member

(This is .NET 10 backport candidate.)

@MichalStrehovsky MichalStrehovsky 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.

Would it make sense to mark DllImportSearchPath values that don't make sense outside Windows as [SupportedOSPlatform("windows")]?

@elinor-fung
elinor-fung merged commit ff381b7 into dotnet:main Sep 3, 2025
97 of 99 checks passed
@elinor-fung
elinor-fung deleted the issue118999 branch September 3, 2025 20:17
@elinor-fung

Copy link
Copy Markdown
Member Author

/backport to release/10.0

@github-actions

github-actions Bot commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/17445055447

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants