diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets
index eecf25270cb920..e57bffc5456e72 100644
--- a/eng/liveBuilds.targets
+++ b/eng/liveBuilds.targets
@@ -322,12 +322,18 @@
"
IsNative="true" />
-
+
/callhelpers-*.cpp) from the testhost and crossgen2 the leg just built,
+# (src/coreclr/vm/wasm//callhelpers-*.cpp and browser flavor subdirectories) from the managed
+# closures and crossgen2 the leg just built,
# and fails if they differ from what is committed. A stale table builds fine but crashes the
# corerun that links it, for example with "GetUnmanagedCallersOnlyThunk: unknown thunk" when a
# new [UnmanagedCallersOnly] method is missing. See src/coreclr/vm/wasm/generate-coreclr-helpers.md.
@@ -44,7 +45,7 @@ steps:
echo "The managed code that feeds these tables ([UnmanagedCallersOnly] methods, P/Invokes, QCalls)"
echo "changed without the tables being regenerated. To fix, run from the repository root:"
echo
- echo " ./build.sh clr+libs -os $target_os -c $configuration"
+ echo " ./build.sh clr+libs+host -os $target_os -c $configuration"
echo " src/coreclr/vm/wasm/generate-coreclr-helpers.sh -c $configuration --target-os $target_os"
echo
echo "and commit the changes under $table_dir."
diff --git a/eng/testing/tests.browser.targets b/eng/testing/tests.browser.targets
index e014647340df06..2a209cb5ffbf7d 100644
--- a/eng/testing/tests.browser.targets
+++ b/eng/testing/tests.browser.targets
@@ -55,6 +55,8 @@
false
true
$(EventSourceSupport)
+ <_WasmCoreClrEventSourceSupportSpecified Condition="'$(RuntimeFlavor)' == 'CoreCLR'">true
+ <_WasmCoreClrEnableDiagnosticsSpecified Condition="'$(RuntimeFlavor)' == 'CoreCLR'">true
true
- <_TargetOS>%(_WasmCallHelperTarget.Identity)
+ <_TargetOS>%(_WasmCallHelperTarget.TargetOS)
<_ScanPath>%(_WasmCallHelperTarget.ScanPath)
<_Crossgen2Path>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'coreclr', '$(_TargetOS).wasm.$(Configuration)', '$(BuildArchitecture)', 'crossgen2', 'crossgen2$(ExeSuffix)'))
- <_OutputDir>$(MSBuildThisFileDirectory)$(_TargetOS)/
- <_ResponseFileDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'wasm-callhelpers', '$(_TargetOS)'))
+ <_OutputDir>%(_WasmCallHelperTarget.OutputDir)
+ <_ResponseFileDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'wasm-callhelpers', '%(_WasmCallHelperTarget.Identity)'))
<_ResponseFile>$(_ResponseFileDir)generate-coreclr-helpers.rsp
<_StagingDir>$(_ResponseFileDir)generated/
@@ -107,12 +121,12 @@
+ Text="Scan path for %(_WasmCallHelperTarget.Identity) does not exist: $(_ScanPath). Build the runtime packs first: $(_BuildScript) clr+libs+host -os $(_TargetOS) -c $(Configuration)" />
-
-
+
+
diff --git a/src/coreclr/vm/wks/CMakeLists.txt b/src/coreclr/vm/wks/CMakeLists.txt
index 96ec823932fb08..03152f31bbbae8 100644
--- a/src/coreclr/vm/wks/CMakeLists.txt
+++ b/src/coreclr/vm/wks/CMakeLists.txt
@@ -11,6 +11,12 @@ add_library_clr(cee_wks_mergeable OBJECT ${VM_SOURCES_WKS_SPECIAL})
if (CLR_CMAKE_TARGET_ARCH_WASM AND VM_SOURCES_WKS_GEN)
add_library_clr(cee_wks_gen OBJECT ${VM_SOURCES_WKS_GEN})
endif()
+if (CLR_CMAKE_TARGET_ARCH_WASM AND VM_SOURCES_WKS_GEN_PRODUCTION)
+ add_library_clr(cee_wks_gen_production OBJECT ${VM_SOURCES_WKS_GEN_PRODUCTION})
+endif()
+if (CLR_CMAKE_TARGET_ARCH_WASM AND VM_SOURCES_WKS_GEN_DIAGNOSTICS)
+ add_library_clr(cee_wks_gen_diagnostics OBJECT ${VM_SOURCES_WKS_GEN_DIAGNOSTICS})
+endif()
target_precompile_headers(cee_wks_core PRIVATE [["common.h"]])
target_precompile_headers(cee_wks PRIVATE [["common.h"]])
@@ -19,6 +25,12 @@ target_precompile_headers(cee_wks_mergeable PRIVATE [["common.h"]])
if (TARGET cee_wks_gen)
target_precompile_headers(cee_wks_gen PRIVATE [["common.h"]])
endif()
+if (TARGET cee_wks_gen_production)
+ target_precompile_headers(cee_wks_gen_production PRIVATE [["common.h"]])
+endif()
+if (TARGET cee_wks_gen_diagnostics)
+ target_precompile_headers(cee_wks_gen_diagnostics PRIVATE [["common.h"]])
+endif()
if (MSVC)
# corelib.cpp does not compile with precompiled header file
@@ -32,6 +44,12 @@ add_dependencies(cee_wks_mergeable eventing_headers)
if (TARGET cee_wks_gen)
add_dependencies(cee_wks_gen eventing_headers)
endif()
+if (TARGET cee_wks_gen_production)
+ add_dependencies(cee_wks_gen_production eventing_headers)
+endif()
+if (TARGET cee_wks_gen_diagnostics)
+ add_dependencies(cee_wks_gen_diagnostics eventing_headers)
+endif()
if (CLR_CMAKE_TARGET_WIN32)
if(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
@@ -61,6 +79,12 @@ add_dependencies(cee_wks_mergeable precompiled_asm)
if (TARGET cee_wks_gen)
add_dependencies(cee_wks_gen precompiled_asm)
endif()
+if (TARGET cee_wks_gen_production)
+ add_dependencies(cee_wks_gen_production precompiled_asm)
+endif()
+if (TARGET cee_wks_gen_diagnostics)
+ add_dependencies(cee_wks_gen_diagnostics precompiled_asm)
+endif()
target_compile_definitions(cee_wks_mergeable PUBLIC FEATURE_STATICALLY_LINKED)
target_compile_definitions(cee_wks_mergeable PUBLIC CORECLR_EMBEDDED)
diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props
index 625a1ebc48ae07..2d4300984f0c4c 100644
--- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props
+++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props
@@ -109,9 +109,11 @@
+
+
+
-
diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj
index 7ca72daf08551c..fe694e6f6ce046 100644
--- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj
+++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj
@@ -47,6 +47,11 @@
<_PublishReadyToRunCrossgen2ExtraArgs>$(_PublishReadyToRunCrossgen2ExtraArgs);--opt-cross-module:*
+
+
+ $(NoWarn);NU5100
+
+
true
@@ -111,7 +116,20 @@
BeforeTargets="_GenerateFrameworkList"
DependsOnTargets="BuildBrowserHost"
Condition="'$(TargetOS)' == 'browser'">
+
+ <_BrowserManagedFlavorRoot>$([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'sfx-finish', '$(LibrariesConfiguration)', '$(NetCoreAppCurrent)-browser'))
+
+
+
- $([MSBuild]::NormalizeDirectory('$(IntermediateOutputPath)', 'illink-$(TargetArchitecture)'))
- $(SharedFrameworkAssembliesTrimDir)linker-marker.txt
+ <_SharedFrameworkTrimFlavorSuffix Condition="'$(SharedFrameworkTrimFlavor)' != ''">-$(SharedFrameworkTrimFlavor)
+ $([MSBuild]::NormalizeDirectory('$(IntermediateOutputPath)', 'illink-$(TargetArchitecture)$(_SharedFrameworkTrimFlavorSuffix)'))
+ <_SharedFrameworkTrimRootModeSuffix Condition="'$(SharedFrameworkTrimRootMode)' != ''">-$(SharedFrameworkTrimRootMode)
+ $(SharedFrameworkAssembliesTrimDir)linker-marker$(_SharedFrameworkTrimRootModeSuffix).txt
+
+
+
+
+
+
@@ -118,19 +128,21 @@
AfterTargets="Build"
Condition="'$(RunILLinkInBuild)' == 'true'"
DependsOnTargets="ResolveProjectReferences;GetTrimSharedFrameworkAssembliesInputs;PrepareForAssembliesTrim"
- Inputs="@(SharedFrameworkAssembly);@(SharedFrameworkSuppressionsXml);$(ILLinkTasksAssembly)"
+ Inputs="$(MSBuildProjectFullPath);@(SharedFrameworkAssembly);@(SharedFrameworkSuppressionsXml);$(ILLinkTasksAssembly)"
Outputs="$(SharedFrameworkAssembliesTrimMarkerFile)">
$(ILLinkArgs)
$(SharedFrameworkILLinkArgs) --link-attributes "@(SharedFrameworkSuppressionsXml, '" --link-attributes "')"
+ IL2121
<_SharedFrameworkRootAssemblyName Include="@(SharedFrameworkAssembly->'%(Filename)')">
- library
+ library
+ $(SharedFrameworkTrimRootMode)
@@ -138,7 +150,9 @@
diff --git a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.BlazorWebAssembly.targets b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.BlazorWebAssembly.targets
new file mode 100644
index 00000000000000..a387a22b6b8608
--- /dev/null
+++ b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.BlazorWebAssembly.targets
@@ -0,0 +1,17 @@
+
+
+
+ <_WasmCoreClrEnableDiagnosticsSpecified Condition="'$(EnableDiagnostics)' != ''">true
+ <_WasmCoreClrEventSourceSupportSpecified Condition="'$(EventSourceSupport)' != ''">true
+
+
+
+
diff --git a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets
index 1877fb41fa3102..ebd156951daf27 100644
--- a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets
+++ b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.targets
@@ -49,19 +49,26 @@ Copyright (c) .NET Foundation. All rights reserved.
<_WasmCoreClrNativeFlavorUnderPublish Condition="'$(_IsPublishing)' == 'true' or '$(WasmBuildingForNestedPublish)' == 'true' or
'$(WasmBuildOnlyAfterPublish)' == 'true' or '$(DeployOnBuild)' == 'true'">true
- false
- true
+ <_WasmCoreClrEffectiveEnableDiagnostics Condition="('$(_WasmCoreClrEnableDiagnosticsSpecified)' == 'true' and '$(EnableDiagnostics)' == 'true') or
+ ('$(_WasmCoreClrEventSourceSupportSpecified)' == 'true' and '$(EventSourceSupport)' == 'true')">true
+ <_WasmCoreClrEffectiveEnableDiagnostics Condition="'$(_WasmCoreClrEffectiveEnableDiagnostics)' == '' and
+ ('$(_WasmCoreClrEnableDiagnosticsSpecified)' == 'true' or '$(_WasmCoreClrEventSourceSupportSpecified)' == 'true')">false
+ <_WasmCoreClrEffectiveEnableDiagnostics Condition="'$(_WasmCoreClrEffectiveEnableDiagnostics)' == '' and '$(_WasmCoreClrNativeFlavorUnderPublish)' == 'true'">false
+ <_WasmCoreClrEffectiveEnableDiagnostics Condition="'$(_WasmCoreClrEffectiveEnableDiagnostics)' == ''">true
+ $(_WasmCoreClrEffectiveEnableDiagnostics)
+ $(_WasmCoreClrEffectiveEnableDiagnostics)
- <_WasmCoreClrNativeFlavor Condition="'$(EnableDiagnostics)' == 'true'">diagnostics
+ <_WasmCoreClrNativeFlavor Condition="'$(_WasmCoreClrEffectiveEnableDiagnostics)' == 'true'">diagnostics
<_WasmCoreClrNativeFlavor Condition="'$(_WasmCoreClrNativeFlavor)' == ''">production
<_WasmCoreClrNativeFlavorRoot>$([MSBuild]::NormalizeDirectory('$(_RuntimePackDir)', 'data', 'native-flavors'))
<_WasmCoreClrSelectedNativeFlavorDir Condition="'$(_WasmCoreClrNativeFlavor)' == 'diagnostics'">$([MSBuild]::NormalizeDirectory('$(_WasmCoreClrNativeFlavorRoot)', 'diagnostics'))
<_WasmCoreClrSelectedNativeFlavorDir Condition="'$(_WasmCoreClrNativeFlavor)' == 'production'">$([MSBuild]::NormalizeDirectory('$(_RuntimePackDir)', 'runtimes', '$(RuntimeIdentifier)', 'native'))
+ <_WasmCoreClrSelectedManagedFlavorDir>$([MSBuild]::NormalizeDirectory('$(_WasmCoreClrNativeFlavorRoot)', '$(_WasmCoreClrNativeFlavor)', 'managed'))
<_WasmCoreClrPrelinkedAsset Include="$(_WasmCoreClrSelectedNativeFlavorDir)dotnet.native.wasm;
@@ -71,6 +78,36 @@ Copyright (c) .NET Foundation. All rights reserved.
+
+
+ <_WasmUsePrebuiltReadyToRun>false
+ <_WasmBuildPrebuiltR2RDirectory>
+
+
+
+
+
+
+ <_WasmCoreClrManagedFlavorAssembly Include="$(_WasmCoreClrSelectedManagedFlavorDir)*.dll" />
+ <_WasmCoreClrManagedFlavorAssemblyName Include="@(_WasmCoreClrManagedFlavorAssembly->';%(FileName)%(Extension);')" />
+
+
+ <_WasmCoreClrManagedFlavorAssemblyNames>@(_WasmCoreClrManagedFlavorAssemblyName)
+
+
+ <_WasmCoreClrManagedFrameworkOriginal Include="@(ReferenceCopyLocalPaths)"
+ Condition="'%(ReferenceCopyLocalPaths.Extension)' == '.dll' and
+ $([System.String]::Copy('$(_WasmCoreClrManagedFlavorAssemblyNames)').Contains(';%(ReferenceCopyLocalPaths.FileName)%(ReferenceCopyLocalPaths.Extension);'))" />
+
+
+
+
+
+
+
+ <_WasmCoreClrEnableDiagnosticsSpecified Condition="'$(EnableDiagnostics)' != ''">true
+ <_WasmCoreClrEventSourceSupportSpecified Condition="'$(EventSourceSupport)' != '' and '$(_WasmEventSourceSupportDefaulted)' != 'true'">true
+
+
+
+
diff --git a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.props b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.props
index 3b44a521a85a16..ac115a457adfcc 100644
--- a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.props
+++ b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.props
@@ -48,6 +48,7 @@ Copyright (c) .NET Foundation. All rights reserved.
Condition="'$(Crossgen2InBuildDir)' != '' or '$(Crossgen2SdkOverridePropsPath)' != ''" />
+ <_BlazorWebAssemblyTargetsFile Condition="'$(_BlazorWebAssemblyTargetsFile)' == ''">$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.WebAssembly.BlazorWebAssembly.targets
$(AfterMicrosoftNETSdkTargets);$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.ReadyToRun.targets
diff --git a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
index 65530f775566c2..7b1eb07ab9a041 100644
--- a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
+++ b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
@@ -1278,7 +1278,9 @@ Copyright (c) .NET Foundation. All rights reserved.
-
+
@@ -1392,6 +1394,7 @@ Copyright (c) .NET Foundation. All rights reserved.
extensions, property stamp) are older than the output, the target is skipped. -->
diff --git a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Pack.targets b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Pack.targets
index f7cec5d5acedc4..f83296c2d495e0 100644
--- a/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Pack.targets
+++ b/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Pack.targets
@@ -11,7 +11,7 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
- <_WebAssemblyTargetsFile>$(MSBuildThisFileDirectory)\Microsoft.NET.Sdk.WebAssembly.Browser.targets
+ <_WebAssemblyTargetsFile>$(MSBuildThisFileDirectory)\Microsoft.NET.Sdk.WebAssembly.Browser.UserSettings.targets
diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WasmFeatures.props b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WasmFeatures.props
index 6e1d190b53b467..e3f0cf7eebca5e 100644
--- a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WasmFeatures.props
+++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WasmFeatures.props
@@ -2,6 +2,7 @@
false
false
+ <_WasmEventSourceSupportDefaulted Condition="'$(EventSourceSupport)' == ''">true
false
false
true
diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/EventPipeDiagnosticsTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/EventPipeDiagnosticsTests.cs
index 24ba33192043a8..accf5da7bcdd54 100644
--- a/src/mono/wasm/Wasm.Build.Tests/Blazor/EventPipeDiagnosticsTests.cs
+++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/EventPipeDiagnosticsTests.cs
@@ -57,7 +57,15 @@ public async Task CoreClrPrelinkedProductionSupportsManagedEventListener()
{
Configuration config = Configuration.Debug;
ProjectInfo info = CopyTestAsset(config, aot: false, TestAsset.BlazorBasicTestApp, "coreclr_production_listener",
- extraProperties: "true");
+ extraProperties: "falsefalse",
+ insertAtEnd: """
+
+
+
+
+
+
+ """);
UpdateFile("Program.cs", new Dictionary
{
["var builder"] = """
@@ -109,7 +117,12 @@ protected override void OnEventWritten(EventWrittenEventArgs eventData)
"""
});
- PublishProject(info, config, new PublishOptions(AssertAppBundle: false, UseCache: false));
+ (string _, string output) = PublishProject(info, config, new PublishOptions(AssertAppBundle: false, UseCache: false));
+ string runtimePackDir = Assert.IsType(ProjectProviderBase.TryGetRuntimePackDirFromBuildOutput(output));
+ string expectedWasm = Path.Combine(runtimePackDir, "runtimes", BuildEnvironment.DefaultRuntimeIdentifier, "native", "dotnet.native.wasm");
+ string actualWasm = Assert.Single(Directory.GetFiles(GetBuildPaths(config, forPublish: true).BinFrameworkDir, "dotnet.native*.wasm"));
+ TestUtils.AssertSameFile(expectedWasm, actualWasm);
+
bool received = false;
bool receivedDynamic = false;
await RunForPublishWithWebServer(new BlazorRunOptions(config,
diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/WorkloadRequiredTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/WorkloadRequiredTests.cs
index 32c543f4185ba5..41c39ccbcf0e19 100644
--- a/src/mono/wasm/Wasm.Build.Tests/Blazor/WorkloadRequiredTests.cs
+++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/WorkloadRequiredTests.cs
@@ -92,6 +92,8 @@ public async Task DefaultTemplate_WithoutWorkload(Configuration config)
[InlineData(true, "", "production")]
[InlineData(false, "false", "production")]
[InlineData(true, "true", "diagnostics")]
+ [InlineData(false, "false", "production")]
+ [InlineData(true, "true", "diagnostics")]
[TestCategory("no-workload")]
public async Task CoreClrPrelinkedNativeFlavorIsSelectedWithoutWorkload(bool publish, string extraProperties, string expectedFlavor)
{
@@ -101,7 +103,21 @@ public async Task CoreClrPrelinkedNativeFlavorIsSelectedWithoutWorkload(bool pub
aot: false,
TestAsset.BlazorBasicTestApp,
$"coreclr_native_flavor_{(publish ? "publish" : "build")}_{expectedFlavor}",
- extraProperties: extraProperties);
+ extraProperties: extraProperties,
+ insertAtEnd: """
+
+
+ <_SelectedCoreLib Include="@(ReferenceCopyLocalPaths)"
+ Condition="'%(FileName)%(Extension)' == 'System.Private.CoreLib.dll'" />
+
+
+
+
+
+
+ """);
(string _, string output) = publish
? PublishProject(info, config, new PublishOptions(UseCache: false))
@@ -125,6 +141,24 @@ public async Task CoreClrPrelinkedNativeFlavorIsSelectedWithoutWorkload(bool pub
SHA256.HashData(File.ReadAllBytes(expectedNativeWasm)),
SHA256.HashData(File.ReadAllBytes(actualNativeWasm)));
+ if (!publish)
+ {
+ string normalizedOutput = output.Replace('\\', '/');
+ string expectedManagedCoreLib = Path.Combine(
+ runtimePackDir,
+ "data",
+ "native-flavors",
+ expectedFlavor,
+ "managed",
+ "System.Private.CoreLib.dll").Replace('\\', '/');
+ Assert.Contains($"** Selected managed CoreLib: {expectedManagedCoreLib}", normalizedOutput, StringComparison.OrdinalIgnoreCase);
+
+ if (expectedFlavor == "diagnostics")
+ Assert.Matches(@"\*\* Selected pack R2R: '.+[/\\]r2r[/\\]?'", output);
+ else
+ Assert.Contains("** Selected pack R2R: ''", output);
+ }
+
BlazorRunOptions runOptions = new(config);
_ = publish
? await RunForPublishWithWebServer(runOptions)
diff --git a/src/mono/wasm/Wasm.Build.Tests/CoreCLRWasmNativeDefaultsTests.cs b/src/mono/wasm/Wasm.Build.Tests/CoreCLRWasmNativeDefaultsTests.cs
index 84d33aa0677d20..16b345371e89ab 100644
--- a/src/mono/wasm/Wasm.Build.Tests/CoreCLRWasmNativeDefaultsTests.cs
+++ b/src/mono/wasm/Wasm.Build.Tests/CoreCLRWasmNativeDefaultsTests.cs
@@ -41,6 +41,8 @@ public CoreCLRWasmNativeDefaultsTests(ITestOutputHelper output, SharedBuildPerTe
{ "false", false },
{ "false", false },
{ "true", false },
+ { "false", false },
+ { "true", false },
// property left unset -> no relink
{ "", false },
// casing must not matter, MSBuild string comparison is case-insensitive
@@ -74,6 +76,37 @@ public void PropertyDifferentFromRuntimePackTriggersRelinking(string extraProper
Assert.Contains($"** WasmBuildNative: '{(expectWasmBuildNative ? "true" : "")}'", line);
}
+ [Theory]
+ [InlineData("false", "production")]
+ [InlineData("true", "diagnostics")]
+ [InlineData("false", "production")]
+ [InlineData("true", "diagnostics")]
+ public void TracingPropertySelectsNativeFlavor(string extraProperties, string expectedFlavor)
+ {
+ Configuration config = Configuration.Debug;
+ ProjectInfo info = CopyTestAsset(
+ config,
+ aot: false,
+ TestAsset.WasmBasicTestApp,
+ "coreclr_native_flavor",
+ extraProperties: extraProperties,
+ insertAtEnd: """
+
+
+
+
+ """);
+
+ (string _, string output) = BuildProject(
+ info,
+ config,
+ new BuildOptions(ExpectSuccess: false));
+
+ Assert.Contains($"** CoreCLR native flavor: '{expectedFlavor}'", output);
+ Assert.Contains("Stopping the build", output);
+ }
+
[Theory]
[InlineData("true")]
[InlineData("true")]
diff --git a/src/native/corehost/browserhost/browserhost.proj b/src/native/corehost/browserhost/browserhost.proj
index cc35d381d9fd6b..55560fd4750cd7 100644
--- a/src/native/corehost/browserhost/browserhost.proj
+++ b/src/native/corehost/browserhost/browserhost.proj
@@ -1,15 +1,23 @@
+ TreatAsLocalProperty="BrowserHostNativeFlavor;IsBrowserWasmProject;RequiresCrossgen2Pack;InvariantGlobalization;InvariantTimezone;EnableDiagnostics;EventSourceSupport;WasmInitialHeapSize;EmccMaximumHeapSize;EmccStackSize">
false
false
production
$([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'browserhost', '$(TargetOS).$(TargetArchitecture).$(Configuration)', '$(BrowserHostNativeFlavor)'))
$([MSBuild]::NormalizeDirectory('$(IntermediateOutputPath)', 'native'))
+ $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'sfx-finish', '$(LibrariesConfiguration)', '$(NetCoreAppCurrent)-browser', 'illink-wasm-$(BrowserHostNativeFlavor)'))
true
-O2
+
+
+
+
@@ -17,23 +25,34 @@
$(BrowserHostInvariantTimezone)
false
true
+ $(EnableDiagnostics)
$(BrowserHostInitialHeapSize)
$(BrowserHostMaximumHeapSize)
$(BrowserHostStackSize)
-
-
+
+
+
+
+
+
+ DependsOnTargets="BuildBrowserHostManagedFlavor;ResolveRuntimeFilesFromLocalBuild;ResolveLibrariesRuntimeFilesFromLocalBuild">
+
<_BrowserHostNativeFile Include="@(RuntimeFiles->WithMetadataValue('IsNative', 'true'));@(LibrariesRuntimeFiles->WithMetadataValue('IsNative', 'true'))"
Exclude="$(LibrariesSharedFrameworkDir)dotnet.native.js;$(LibrariesSharedFrameworkDir)native-flavors\**\*"