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

Support overriding MsQuic.dll in the application directory on Windows. #103351

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Net.Sockets;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.Quic;
using static Microsoft.Quic.MsQuic;
Expand Down Expand Up @@ -89,8 +90,20 @@ 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);
// we ship Schannel version of MsQuic as part of the .NET runtime.
rzikm marked this conversation as resolved.
Show resolved Hide resolved
// This version works on newer OS versions (see s_minWindowsVersion).
//
// For cases where the Schannel version cannot be used, we want to
// support developers explicitly providing OpenSSL version of MsQuic.
// in the application directory, so we first check there and default
// to the Schannel version if not found.
rzikm marked this conversation as resolved.
Show resolved Hide resolved
#pragma warning disable IL3000
rzikm marked this conversation as resolved.
Show resolved Hide resolved
loaded = NativeLibrary.TryLoad(Path.Combine(AppContext.BaseDirectory, Interop.Libraries.MsQuic), out msQuicHandle);
rzikm marked this conversation as resolved.
Show resolved Hide resolved

if (!loaded)
{
loaded = NativeLibrary.TryLoad(Interop.Libraries.MsQuic, typeof(MsQuicApi).Assembly, DllImportSearchPath.AssemblyDirectory, out msQuicHandle);
}
}
else
{
Expand Down
Loading