Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use explicit full-path for loading MsQuic.dll on Windows #109963

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

rzikm
Copy link
Member

@rzikm rzikm commented Nov 19, 2024

This PR explicitly composes the path from which MsQuic.dll is attempted to be loaded. It also logs the path to enable better diagnostics.

rzikm and others added 2 commits November 19, 2024 15:37
A call to `Assembly.Location` was added in a recent fix. It has `IL30000` suppressed via `#pragma warning disable`, but that only applies to the compilation of the library itself. Consumers will hit it when doing something like publishing their app as NativeAOT.

This change adds an `[UnconditionalSuppressMessage]` to the `MsQuicApi` static constructor such that `IL30000` should also be suppressed for apps consuming the runtime.

This was caught in an aspnetcore deps flow PR coming from runtime.
Copy link
Contributor

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@rzikm rzikm merged commit 6be24fd into dotnet:main Nov 20, 2024
81 of 83 checks passed
@@ -89,8 +91,23 @@ static MsQuicApi()

if (OperatingSystem.IsWindows())
{
// Windows ships msquic in the assembly directory.
loaded = NativeLibrary.TryLoad(Interop.Libraries.MsQuic, typeof(MsQuicApi).Assembly, DllImportSearchPath.AssemblyDirectory, out msQuicHandle);
#pragma warning disable IL3000 // Avoid accessing Assembly file path when publishing as a single file
Copy link
Member

Choose a reason for hiding this comment

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

Why adding this pragma? The UnconditionalSuppress should already suppress this. Feels like this will just make it more likely to get #109958 resurface, whenever someone just mindlessly copies/pastes this code to somewhere else.

mikelle-rogers pushed a commit to mikelle-rogers/runtime that referenced this pull request Dec 10, 2024
* Use explicit full-path for loading MsQuic.dll on Windows

* Suppress IL3000 in MsQuicApi constructor

A call to `Assembly.Location` was added in a recent fix. It has `IL30000` suppressed via `#pragma warning disable`, but that only applies to the compilation of the library itself. Consumers will hit it when doing something like publishing their app as NativeAOT.

This change adds an `[UnconditionalSuppressMessage]` to the `MsQuicApi` static constructor such that `IL30000` should also be suppressed for apps consuming the runtime.

This was caught in an aspnetcore deps flow PR coming from runtime.

---------

Co-authored-by: Elinor Fung <elfung@microsoft.com>
mikelle-rogers pushed a commit to mikelle-rogers/runtime that referenced this pull request Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants