diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets
index b324a4da7d2659..1c5cb833874880 100644
--- a/src/mono/wasm/build/WasmApp.targets
+++ b/src/mono/wasm/build/WasmApp.targets
@@ -126,7 +126,7 @@
$(DOTNET_HOST_PATH)
dotnet
- exec $([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost.dll')) --runtime-config $(_AppBundleDirForRunCommand)/$(AssemblyName).runtimeconfig.json $(WasmHostArguments)
+ exec "$([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost.dll'))" --runtime-config "$(_AppBundleDirForRunCommand)/$(AssemblyName).runtimeconfig.json" $(WasmHostArguments)
$(_AppBundleDirForRunCommand)
diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/BrowserRunner.cs b/src/tests/BuildWasmApps/Wasm.Build.Tests/BrowserRunner.cs
index c39818f033d66b..13a4ff96ab761a 100644
--- a/src/tests/BuildWasmApps/Wasm.Build.Tests/BrowserRunner.cs
+++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/BrowserRunner.cs
@@ -77,12 +77,12 @@ public async Task RunAsync(ToolCommand cmd, string args, bool headless =
var url = new Uri(urlAvailable.Task.Result);
Playwright = await Microsoft.Playwright.Playwright.CreateAsync();
+ string[] chromeArgs = new[] { $"--explicitly-allowed-ports={url.Port}" };
+ Console.WriteLine($"Launching chrome ('{s_chromePath.Value}') via playwright with args = {string.Join(',', chromeArgs)}");
Browser = await Playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions{
ExecutablePath = s_chromePath.Value,
Headless = headless,
- Args = OperatingSystem.IsWindows()
- ? new[] { $"--explicitly-allowed-ports={url.Port}" }
- : Array.Empty()
+ Args = chromeArgs
});
IPage page = await Browser.NewPageAsync();