From 3a6fc48ad18c950e4ccd2a1e402c30a0189d4a62 Mon Sep 17 00:00:00 2001 From: Radek Zikmund Date: Wed, 28 Aug 2024 15:50:24 +0200 Subject: [PATCH 1/3] Use explicit full-path for loading MsQuic.dll --- .../src/System/Net/Quic/Internal/MsQuicApi.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs index e07a99b13f7c7..7b89d8513a555 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs @@ -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 { From c0d902181d5e48727d68108865f30146e8886ccc Mon Sep 17 00:00:00 2001 From: Radek Zikmund Date: Wed, 28 Aug 2024 16:11:23 +0200 Subject: [PATCH 2/3] Fix wording of comment --- .../src/System/Net/Quic/Internal/MsQuicApi.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs index 7b89d8513a555..4148f4ac1cc43 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs @@ -84,9 +84,9 @@ static MsQuicApi() if (OperatingSystem.IsWindows()) { #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 + // 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; @@ -169,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); @@ -193,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); From 85de95211b9e0d72325c8dbfcbfe98a0bb78a2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Mon, 2 Dec 2024 23:31:55 +0100 Subject: [PATCH 3/3] [release/8.0] [browser] Fix processing of satellite assemblies from referenced assembly during publish (#109920) * Enable satellite discovery in nested build and include them in WasmAssembliesFinal * Fix RawFileName for satellites from References --- src/mono/wasm/build/WasmApp.targets | 3 ++- .../ComputeWasmBuildAssets.cs | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index bc92659fa3479..814acbdf5bae2 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -207,7 +207,7 @@ + Properties="_WasmInNestedPublish_UniqueProperty_XYZ=true;;WasmBuildingForNestedPublish=true;DeployOnBuild=;_IsPublishing=;_WasmIsPublishing=$(_IsPublishing);ResolveAssemblyReferencesFindRelatedSatellites=true"> @@ -503,6 +503,7 @@ + diff --git a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmBuildAssets.cs b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmBuildAssets.cs index f2e4336da3630..20f80f15680cf 100644 --- a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmBuildAssets.cs +++ b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmBuildAssets.cs @@ -111,7 +111,12 @@ public override bool Execute() assetCandidate.SetMetadata("AssetTraitName", "Culture"); assetCandidate.SetMetadata("AssetTraitValue", inferredCulture); assetCandidate.SetMetadata("RelativePath", $"_framework/{inferredCulture}/{satelliteAssembly.GetMetadata("FileName")}{satelliteAssembly.GetMetadata("Extension")}"); - assetCandidate.SetMetadata("RelatedAsset", Path.GetFullPath(Path.Combine(OutputPath, "wwwroot", "_framework", Path.GetFileName(assetCandidate.GetMetadata("ResolvedFrom"))))); + + var resolvedFrom = assetCandidate.GetMetadata("ResolvedFrom"); + if (resolvedFrom == "{RawFileName}") // Satellite assembly found from `` element + resolvedFrom = candidate.GetMetadata("OriginalItemSpec"); + + assetCandidate.SetMetadata("RelatedAsset", Path.GetFullPath(Path.Combine(OutputPath, "wwwroot", "_framework", Path.GetFileName(resolvedFrom)))); assetCandidates.Add(assetCandidate); continue;