-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Conversation
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.
Tagging subscribers to this area: @dotnet/ncl |
@@ -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 |
There was a problem hiding this comment.
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.
This PR explicitly composes the path from which MsQuic.dll is attempted to be loaded. It also logs the path to enable better diagnostics.