From 87e7399a82b2ef83218bf91e5219f5c874a9e6eb Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Fri, 28 Jun 2024 12:02:27 +0000 Subject: [PATCH 01/11] Fix - aot doesn't support managed debugging --- .../wasm/Wasm.Build.Tests/Blazor/NativeRefTests.cs | 14 ++++++++++++++ src/mono/wasm/build/WasmApp.Common.targets | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/NativeRefTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/NativeRefTests.cs index fac71883e3f2ae..b9704f59fcdeee 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/NativeRefTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/NativeRefTests.cs @@ -74,4 +74,18 @@ public void BlazorWasm_CannotAOT_WithNoTrimming(string config) (CommandResult res, _) = BlazorPublish(new BlazorBuildOptions(id, config, ExpectSuccess: false)); Assert.Contains("AOT is not supported without IL trimming", res.Output); } + + [Theory] + [InlineData("Debug")] + public void BlazorWasm_CannotAOT_InDebug(string config) + { + string id = $"blazorwasm_{config}_aot_{GetRandomId()}"; + CreateBlazorWasmTemplateProject(id); + AddItemsPropertiesToProject(Path.Combine(_projectDir!, $"{id}.csproj"), + extraItems: null, + extraProperties: "true"); + + (CommandResult res, _) = BlazorPublish(new BlazorBuildOptions(id, config, ExpectSuccess: false)); + Assert.Contains("AOT is not supported without in debug configuration", res.Output); + } } diff --git a/src/mono/wasm/build/WasmApp.Common.targets b/src/mono/wasm/build/WasmApp.Common.targets index 6aafca7d110a2f..4c2ac364b82d00 100644 --- a/src/mono/wasm/build/WasmApp.Common.targets +++ b/src/mono/wasm/build/WasmApp.Common.targets @@ -621,6 +621,8 @@ + From 3a2c963f336b3b20bf271d05269770b35a6fc7dc Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Mon, 1 Jul 2024 10:34:05 +0200 Subject: [PATCH 02/11] Fix aot-profiling sample. --- src/mono/browser/runtime/cwraps.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mono/browser/runtime/cwraps.ts b/src/mono/browser/runtime/cwraps.ts index 61ae0be40c7686..5c7dcb47196773 100644 --- a/src/mono/browser/runtime/cwraps.ts +++ b/src/mono/browser/runtime/cwraps.ts @@ -325,8 +325,10 @@ export function init_c_exports (): void { if (lazyOrSkip === true || maybeSkip) { // lazy init on first run wf[name] = function (...args: any[]) { - const isNotSkipped = !maybeSkip || !lazyOrSkip(); - mono_assert(isNotSkipped, () => `cwrap ${name} should not be called when binding was skipped`); + if (!runtimeHelpers.emscriptenBuildOptions.enableAotProfiler) { + const isNotSkipped = !maybeSkip || !lazyOrSkip(); + mono_assert(isNotSkipped, () => `cwrap ${name} should not be called when binding was skipped`); + } const fce = cwrap(name, returnType, argTypes, opts); wf[name] = fce; return fce(...args); From 6c3ef4c0c0c85b0ebaa299e498ff854aeae9bff7 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Mon, 1 Jul 2024 15:15:28 +0200 Subject: [PATCH 03/11] Fix browser wbt --- .../Blazor/BuildPublishTests.cs | 20 ++++++++++++++++++- .../wasm/Wasm.Build.Tests/Blazor/MiscTests.cs | 1 - .../Wasm.Build.Tests/Blazor/NativeRefTests.cs | 14 ------------- .../Wasm.Build.Tests/Blazor/SimpleRunTests.cs | 1 - .../Wasm.Build.Tests/BuildPublishTests.cs | 20 ++++++++++++++++++- src/mono/wasm/build/WasmApp.Common.targets | 4 ++-- 6 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs index fc22d03b303bcc..2d1dbc8711aff1 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs @@ -42,7 +42,11 @@ public async Task DefaultTemplate_WithoutWorkload(string config) public static TheoryData TestDataForDefaultTemplate_WithWorkload(bool isAot) { var data = new TheoryData(); - data.Add("Debug", false); + if (!isAot) + { + // AOT does not support managed debugging, is disabled by design + data.Add("Debug", false); + } data.Add("Release", false); // Release relinks by default // [ActiveIssue("https://github.com/dotnet/runtime/issues/83497", TestPlatforms.Windows)] if (!isAot || !RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) @@ -197,4 +201,18 @@ public async Task Test_WasmStripILAfterAOT(string stripILAfterAOT, bool expectIL WasmTemplateTests.TestWasmStripILAfterAOTOutput(objBuildDir, frameworkDir, expectILStripping, _testOutput); } + + [Theory] + [InlineData("Debug")] + public void BlazorWasm_CannotAOT_InDebug(string config) + { + string id = $"blazorwasm_{config}_aot_{GetRandomId()}"; + CreateBlazorWasmTemplateProject(id); + AddItemsPropertiesToProject(Path.Combine(_projectDir!, $"{id}.csproj"), + extraItems: null, + extraProperties: "true"); + + (CommandResult res, _) = BlazorPublish(new BlazorBuildOptions(id, config, ExpectSuccess: false)); + Assert.Contains("AOT is not supported in debug configuration", res.Output); + } } diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests.cs index e01a9f4f3e6428..c93ec2c6af452f 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests.cs @@ -53,7 +53,6 @@ public void NativeBuild_WithDeployOnBuild_UsedByVS(string config, bool nativeRel } [Theory] - [InlineData("Debug")] [InlineData("Release")] public void DefaultTemplate_AOT_InProjectFile(string config) { diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/NativeRefTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/NativeRefTests.cs index b9704f59fcdeee..fac71883e3f2ae 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/NativeRefTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/NativeRefTests.cs @@ -74,18 +74,4 @@ public void BlazorWasm_CannotAOT_WithNoTrimming(string config) (CommandResult res, _) = BlazorPublish(new BlazorBuildOptions(id, config, ExpectSuccess: false)); Assert.Contains("AOT is not supported without IL trimming", res.Output); } - - [Theory] - [InlineData("Debug")] - public void BlazorWasm_CannotAOT_InDebug(string config) - { - string id = $"blazorwasm_{config}_aot_{GetRandomId()}"; - CreateBlazorWasmTemplateProject(id); - AddItemsPropertiesToProject(Path.Combine(_projectDir!, $"{id}.csproj"), - extraItems: null, - extraProperties: "true"); - - (CommandResult res, _) = BlazorPublish(new BlazorBuildOptions(id, config, ExpectSuccess: false)); - Assert.Contains("AOT is not supported without in debug configuration", res.Output); - } } diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/SimpleRunTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/SimpleRunTests.cs index fdce8ea756f844..433d77699c1c76 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/SimpleRunTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/SimpleRunTests.cs @@ -78,7 +78,6 @@ public async Task BlazorBuildAndRunForDifferentOutputPaths(string config, bool a [Theory] [InlineData("Debug", false)] - [InlineData("Debug", true)] [InlineData("Release", false)] [InlineData("Release", true)] public async Task BlazorPublishRunTest(string config, bool aot) diff --git a/src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs b/src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs index f287fa4574164a..33bef306818efd 100644 --- a/src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs @@ -21,6 +21,25 @@ public BuildPublishTests(ITestOutputHelper output, SharedBuildPerTestClassFixtur { } + [Theory] + [BuildAndRun(host: RunHost.Chrome, aot: true, config: "Debug")] + public void Wasm_CannotAOT_InDebug(BuildArgs buildArgs, string config) + { + string projectName = GetTestProjectPath(prefix: "no_aot_in_debug", config: buildArgs.Config); + buildArgs = buildArgs with { ProjectName = projectName }; + buildArgs = ExpandBuildArgs(buildArgs); + (string projectDir, string buildOutput) = BuildProject(buildArgs, + id: id, + new BuildProjectOptions( + InitProject: () => File.WriteAllText(Path.Combine(_projectDir!, "Program.cs"), s_mainReturns42), + DotnetWasmFromRuntimePack: !relinked, + CreateProject: true, + Publish: false + )); + + Assert.Contains("AOT is not supported in debug configuration", buildOutput); + } + [Theory] [BuildAndRun(host: RunHost.Chrome, aot: false, config: "Release")] [BuildAndRun(host: RunHost.Chrome, aot: false, config: "Debug")] @@ -71,7 +90,6 @@ void Run() => RunAndTestWasmApp( [Theory] [BuildAndRun(host: RunHost.Chrome, aot: true, config: "Release")] - [BuildAndRun(host: RunHost.Chrome, aot: true, config: "Debug")] public void BuildThenPublishWithAOT(BuildArgs buildArgs, RunHost host, string id) { bool testUnicode = true; diff --git a/src/mono/wasm/build/WasmApp.Common.targets b/src/mono/wasm/build/WasmApp.Common.targets index 4c2ac364b82d00..beccccae461df1 100644 --- a/src/mono/wasm/build/WasmApp.Common.targets +++ b/src/mono/wasm/build/WasmApp.Common.targets @@ -247,7 +247,7 @@ - + <_WasmDebuggerSupport Condition="'$(WasmDebugLevel)' != '' and '$(WasmDebugLevel)' != '0'">true <_WasmDebuggerSupport Condition="'$(WasmDebugLevel)' != '' and '$(WasmDebugLevel)' == '0'">false @@ -622,7 +622,7 @@ + Text="AOT is not supported in debug configuration (Configuration=Release required)." /> From a60e430419fd47f5f53b1e4e22ef8a728fca4f4e Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 2 Jul 2024 06:48:07 +0000 Subject: [PATCH 04/11] Fix wasi wbt. --- src/mono/wasi/Wasi.Build.Tests/WasiTemplateTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mono/wasi/Wasi.Build.Tests/WasiTemplateTests.cs b/src/mono/wasi/Wasi.Build.Tests/WasiTemplateTests.cs index 82b8844c5cb6e0..9b46e29d05fd40 100644 --- a/src/mono/wasi/Wasi.Build.Tests/WasiTemplateTests.cs +++ b/src/mono/wasi/Wasi.Build.Tests/WasiTemplateTests.cs @@ -96,7 +96,8 @@ public void ConsoleBuildThenRunThenPublish(string config, bool singleFileBundle, CreateProject: false, Publish: true, TargetFramework: BuildTestBase.DefaultTargetFramework, - UseCache: false)); + UseCache: false, + ExpectSuccess: !(config == "Debug" && aot))); } [Theory] From c87e7daef5f04849faa01ae10f5b75b59b949bba Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 2 Jul 2024 06:49:31 +0000 Subject: [PATCH 05/11] fix wbt --- src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs b/src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs index 33bef306818efd..4b1273b7c52a3a 100644 --- a/src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs @@ -23,7 +23,7 @@ public BuildPublishTests(ITestOutputHelper output, SharedBuildPerTestClassFixtur [Theory] [BuildAndRun(host: RunHost.Chrome, aot: true, config: "Debug")] - public void Wasm_CannotAOT_InDebug(BuildArgs buildArgs, string config) + public void Wasm_CannotAOT_InDebug(BuildArgs buildArgs, RunHost host, string id) { string projectName = GetTestProjectPath(prefix: "no_aot_in_debug", config: buildArgs.Config); buildArgs = buildArgs with { ProjectName = projectName }; From 4fc8e2aef9ff5261297dc6f7fb2308b70baf6732 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 2 Jul 2024 11:31:25 +0000 Subject: [PATCH 06/11] Fix --- src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs b/src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs index 4b1273b7c52a3a..31807b6d54bb7b 100644 --- a/src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/BuildPublishTests.cs @@ -23,7 +23,7 @@ public BuildPublishTests(ITestOutputHelper output, SharedBuildPerTestClassFixtur [Theory] [BuildAndRun(host: RunHost.Chrome, aot: true, config: "Debug")] - public void Wasm_CannotAOT_InDebug(BuildArgs buildArgs, RunHost host, string id) + public void Wasm_CannotAOT_InDebug(BuildArgs buildArgs, RunHost _, string id) { string projectName = GetTestProjectPath(prefix: "no_aot_in_debug", config: buildArgs.Config); buildArgs = buildArgs with { ProjectName = projectName }; @@ -32,11 +32,14 @@ public void Wasm_CannotAOT_InDebug(BuildArgs buildArgs, RunHost host, string id) id: id, new BuildProjectOptions( InitProject: () => File.WriteAllText(Path.Combine(_projectDir!, "Program.cs"), s_mainReturns42), - DotnetWasmFromRuntimePack: !relinked, + DotnetWasmFromRuntimePack: true, CreateProject: true, - Publish: false + Publish: true, + ExpectSuccess: false )); + Console.WriteLine($"buildOutput={buildOutput}"); + Assert.Contains("AOT is not supported in debug configuration", buildOutput); } From afb6e0d3d9f9e34bcc1bed2c4eb81cae404646aa Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Tue, 2 Jul 2024 15:35:50 +0200 Subject: [PATCH 07/11] Debug + aot on linux should not be tested in this test. --- src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs index 2d1dbc8711aff1..2c96d2096b7e02 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs @@ -49,7 +49,7 @@ public static TheoryData TestDataForDefaultTemplate_WithWorkload(b } data.Add("Release", false); // Release relinks by default // [ActiveIssue("https://github.com/dotnet/runtime/issues/83497", TestPlatforms.Windows)] - if (!isAot || !RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + if (!isAot && !RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { data.Add("Debug", true); // for aot:true on Windows, it fails } From ca1b119a4ef1e565bc4bb4aeb91da4ea701fe7b2 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Tue, 2 Jul 2024 15:37:36 +0200 Subject: [PATCH 08/11] Cleanup of previous commit. --- .../wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs index 2c96d2096b7e02..9fe78d3df50726 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs @@ -48,15 +48,14 @@ public static TheoryData TestDataForDefaultTemplate_WithWorkload(b data.Add("Debug", false); } data.Add("Release", false); // Release relinks by default - // [ActiveIssue("https://github.com/dotnet/runtime/issues/83497", TestPlatforms.Windows)] - if (!isAot && !RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - data.Add("Debug", true); // for aot:true on Windows, it fails - } // [ActiveIssue("https://github.com/dotnet/runtime/issues/83497", TestPlatforms.Windows)] if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { + if (!isAot) + { + data.Add("Debug", true); + } data.Add("Release", true); } return data; From 7451fde03a4d7ab300b8aa25eb6a3f224cee8d6b Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Tue, 2 Jul 2024 16:48:53 +0200 Subject: [PATCH 09/11] Revert changes to cwraps, fix the sample. --- src/mono/browser/runtime/cwraps.ts | 6 ++---- .../wasm/browser-profile/Wasm.BrowserProfile.Sample.csproj | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mono/browser/runtime/cwraps.ts b/src/mono/browser/runtime/cwraps.ts index 5c7dcb47196773..61ae0be40c7686 100644 --- a/src/mono/browser/runtime/cwraps.ts +++ b/src/mono/browser/runtime/cwraps.ts @@ -325,10 +325,8 @@ export function init_c_exports (): void { if (lazyOrSkip === true || maybeSkip) { // lazy init on first run wf[name] = function (...args: any[]) { - if (!runtimeHelpers.emscriptenBuildOptions.enableAotProfiler) { - const isNotSkipped = !maybeSkip || !lazyOrSkip(); - mono_assert(isNotSkipped, () => `cwrap ${name} should not be called when binding was skipped`); - } + const isNotSkipped = !maybeSkip || !lazyOrSkip(); + mono_assert(isNotSkipped, () => `cwrap ${name} should not be called when binding was skipped`); const fce = cwrap(name, returnType, argTypes, opts); wf[name] = fce; return fce(...args); diff --git a/src/mono/sample/wasm/browser-profile/Wasm.BrowserProfile.Sample.csproj b/src/mono/sample/wasm/browser-profile/Wasm.BrowserProfile.Sample.csproj index 81f03cdc9878f8..6587f88d80dc09 100644 --- a/src/mono/sample/wasm/browser-profile/Wasm.BrowserProfile.Sample.csproj +++ b/src/mono/sample/wasm/browser-profile/Wasm.BrowserProfile.Sample.csproj @@ -1,7 +1,7 @@ true - aot; + aot;browser; From 35aedcddcb12e96a98a4a073f209a37aad24b978 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Wed, 3 Jul 2024 10:15:18 +0200 Subject: [PATCH 10/11] Feedback --- src/mono/browser/runtime/cwraps.ts | 2 +- .../wasm/browser-profile/Wasm.BrowserProfile.Sample.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/browser/runtime/cwraps.ts b/src/mono/browser/runtime/cwraps.ts index 61ae0be40c7686..794682b7e6c292 100644 --- a/src/mono/browser/runtime/cwraps.ts +++ b/src/mono/browser/runtime/cwraps.ts @@ -67,7 +67,7 @@ const fn_signatures: SigLine[] = [ [true, "mono_wasm_set_main_args", "void", ["number", "number"]], // These two need to be lazy because they may be missing [() => !runtimeHelpers.emscriptenBuildOptions.enableAotProfiler, "mono_wasm_profiler_init_aot", "void", ["string"]], - [() => !runtimeHelpers.emscriptenBuildOptions.enableBrowserProfiler, "mono_wasm_profiler_init_aot", "void", ["string"]], + [() => !runtimeHelpers.emscriptenBuildOptions.enableBrowserProfiler, "mono_wasm_profiler_init_browser", "void", ["string"]], [true, "mono_wasm_profiler_init_browser", "void", ["number"]], [false, "mono_wasm_exec_regression", "number", ["number", "string"]], [false, "mono_wasm_invoke_jsexport", "void", ["number", "number"]], diff --git a/src/mono/sample/wasm/browser-profile/Wasm.BrowserProfile.Sample.csproj b/src/mono/sample/wasm/browser-profile/Wasm.BrowserProfile.Sample.csproj index 6587f88d80dc09..81f03cdc9878f8 100644 --- a/src/mono/sample/wasm/browser-profile/Wasm.BrowserProfile.Sample.csproj +++ b/src/mono/sample/wasm/browser-profile/Wasm.BrowserProfile.Sample.csproj @@ -1,7 +1,7 @@ true - aot;browser; + aot; From 90132bee4190114047436fd9c4047928888aab6f Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Wed, 3 Jul 2024 13:46:22 +0200 Subject: [PATCH 11/11] Remove aot + debug. --- .../Wasm.Build.Tests/Templates/WasmTemplateTests.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs b/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs index ac20f6f784513e..a17dc522988d23 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs @@ -21,7 +21,7 @@ public WasmTemplateTests(ITestOutputHelper output, SharedBuildPerTestClassFixtur { } - private string StringReplaceWithAssert(string oldContent, string oldValue, string newValue) + private string StringReplaceWithAssert(string oldContent, string oldValue, string newValue) { string newContent = oldContent.Replace(oldValue, newValue); if (oldValue != newValue && oldContent == newContent) @@ -57,11 +57,11 @@ private void UpdateConsoleProgramCs() private void UpdateBrowserMainJs(string targetFramework, string runtimeAssetsRelativePath = DefaultRuntimeAssetsRelativePath) { base.UpdateBrowserMainJs( - (mainJsContent) => + (mainJsContent) => { // .withExitOnUnhandledError() is available only only >net7.0 mainJsContent = StringReplaceWithAssert( - mainJsContent, + mainJsContent, ".create()", (targetFramework == "net8.0" || targetFramework == "net9.0") ? ".withConsoleForwarding().withElementOnExit().withExitCodeLogging().withExitOnUnhandledError().create()" @@ -75,8 +75,8 @@ private void UpdateBrowserMainJs(string targetFramework, string runtimeAssetsRel mainJsContent = StringReplaceWithAssert(mainJsContent, "from './_framework/dotnet.js'", $"from '{runtimeAssetsRelativePath}dotnet.js'"); return mainJsContent; - }, - targetFramework, + }, + targetFramework, runtimeAssetsRelativePath ); } @@ -121,7 +121,7 @@ public void BrowserBuildThenPublish(string config) var buildArgs = new BuildArgs(projectName, config, false, id, null); - AddItemsPropertiesToProject(projectFile, + AddItemsPropertiesToProject(projectFile, atTheEnd: """ @@ -389,7 +389,6 @@ public static TheoryData TestDataForConsolePublishAndRun() // [ActiveIssue("https://github.com/dotnet/runtime/issues/71887", TestPlatforms.Windows)] if (!OperatingSystem.IsWindows()) { - data.Add("Debug", true, false); data.Add("Release", true, false); }