Skip to content

Commit

Permalink
Merge pull request #109742 from vseanreesermsft/internal-merge-8.0-20…
Browse files Browse the repository at this point in the history
…24-11-12-1233

Merging internal commits for release/8.0
  • Loading branch information
carlossanlop authored Dec 2, 2024
2 parents 18be5f1 + 0cb305f commit 2eb7dd0
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,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
// Windows ships msquic in the assembly directory next to System.Net.Quic, so load that.
// For single-file deployments, the assembly location is an empty string so we fall back
// to AppContext.BaseDirectory which is the directory containing the single-file executable.
string path = typeof(MsQuicApi).Assembly.Location is string assemblyLocation && !string.IsNullOrEmpty(assemblyLocation)
? System.IO.Path.GetDirectoryName(assemblyLocation)!
: AppContext.BaseDirectory;
#pragma warning restore IL3000

path = System.IO.Path.Combine(path, Interop.Libraries.MsQuic);

if (NetEventSource.Log.IsEnabled())
{
NetEventSource.Info(null, $"Attempting to load MsQuic from {path}");
}

loaded = NativeLibrary.TryLoad(path, typeof(MsQuicApi).Assembly, DllImportSearchPath.LegacyBehavior, out msQuicHandle);
}
else
{
Expand Down Expand Up @@ -154,7 +169,7 @@ static MsQuicApi()

if (version < s_minMsQuicVersion)
{
NotSupportedReason = $"Incompatible MsQuic library version '{version}', expecting higher than '{s_minMsQuicVersion}'.";
NotSupportedReason = $"Incompatible MsQuic library version '{version}', expecting higher than '{s_minMsQuicVersion}'.";
if (NetEventSource.Log.IsEnabled())
{
NetEventSource.Info(null, NotSupportedReason);
Expand All @@ -178,7 +193,7 @@ static MsQuicApi()
// Implies windows platform, check TLS1.3 availability
if (!IsWindowsVersionSupported())
{
NotSupportedReason = $"Current Windows version ({Environment.OSVersion}) is not supported by QUIC. Minimal supported version is {s_minWindowsVersion}.";
NotSupportedReason = $"Current Windows version ({Environment.OSVersion}) is not supported by QUIC. Minimal supported version is {s_minWindowsVersion}.";
if (NetEventSource.Log.IsEnabled())
{
NetEventSource.Info(null, NotSupportedReason);
Expand Down

0 comments on commit 2eb7dd0

Please sign in to comment.