Skip to content

[browser][publish] Unicode in the path are not parsed correctly in Windows for AOT/relink by emcc #83497

Closed
@ilonatommy

Description

@ilonatommy

Original issue:

The problem exists only on Windows. When we want to relink or we switch on AOT in Blazor app, we are triggering a task that is executing emscripten like this:

<Exec Command='emcc "@$(_EmccDefaultFlagsRsp)" "@$(_EmccDefaultLinkFlagsRsp)" "@$(_EmccLinkRsp)"' EnvironmentVariables="@(EmscriptenEnvVars)" ConsoleToMSBuild="true">

_EmccLinkRsp parameter contains the project name and in case this name has unicode chars in it, emscripten will parse it as "?" and will not be able to find the path:

Failed opening 'artifacts\bin\Wasm.Build.Tests\Debug\net8.0\browser-wasm\wbt\blz_dllimp_Release_?build_then_publish\obj\Release\net8.0\wasm\for-build\dotnet.wasm'
        emcc : error : 'artifacts\bin\dotnet-latest\packs\Microsoft.NET.Runtime.Emscripten.3.1.12.Sdk.win-x64\8.0.0-preview.3.23127.2\tools\bin\wasm-emscripten-finalize -g --dyncalls-i64 --dwarf \runtime-fork2\artifacts\bin\Wasm.Build.Tests\Debug\net8.0\browser-wasm\wbt\blz_dllimp_Release_?build_then_publish\obj\Release\net8.0\wasm\for-build\dotnet.wasm -o \runtime-fork2\artifacts\bin\Wasm.Build.Tests\Debug\net8.0\browser-wasm\wbt\blz_dllimp_Release_?build_then_publish\obj\Release\net8.0\wasm\for-build\dotnet.wasm --detect-features' failed (returned 1)
        artifacts\bin\dotnet-latest\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\8.0.0-dev\Sdk\WasmApp.Native.targets(468,5): error MSB3073: The command "emcc "@\artifacts\bin\dotnet-latest\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-dev\runtimes\browser-wasm\native\src\emcc-default.rsp" "@artifacts\bin\dotnet-latest\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\8.0.0-dev\runtimes\browser-wasm\native\src\emcc-link.rsp" "@artifacts\bin\Wasm.Build.Tests\Debug\net8.0\browser-wasm\wbt\blz_dllimp_Release_?build_then_publish\obj\Release\net8.0\wasm\for-build\emcc-link.rsp"" exited with code 1

The issue was discovered in #82833. The test for relink on Blazor for unicode characters

public void DefaultTemplate_NoAOT_WithWorkload(string config)

got disabled.

Current state:

Fatal: Failed opening 'C:\Users\username\source\repos\runtime-fork\artifacts\bin\Wasm.Build.Tests\Release\net9.0\win-x64\wbt artifacts\xpk1al41_fpx_?\obj\Debug\net9.0\wasm\for-publish\dotnet.native.wasm'
        [] emcc : error : 'C:\Users\username\source\repos\runtime-fork\artifacts\bin\dotnet-latest\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.win-x64\9.0.0-preview.6.24277.2\tools\bin\wasm-opt --strip-dwarf --post-emscripten -Oz --low-memory-unused --zero-filled-memory --pass-arg=directize-initial-contents-immutable --strip-debug --strip-producers "C:\Users\username\source\repos\runtime-fork\artifacts\bin\Wasm.Build.Tests\Release\net9.0\win-x64\wbt artifacts\xpk1al41_fpx_\u9fc0\obj\Debug\net9.0\wasm\for-publish\dotnet.native.wasm" -o "C:\Users\username\source\repos\runtime-fork\artifacts\bin\Wasm.Build.Tests\Release\net9.0\win-x64\wbt artifacts\xpk1al41_fpx_\u9fc0\obj\Debug\net9.0\wasm\for-publish\dotnet.native.wasm" --mvp-features --enable-exception-handling --enable-mutable-globals --enable-sign-ext --enable-simd' failed (returned 1) 
        [] C:\Users\username\source\repos\runtime-fork\artifacts\bin\dotnet-latest\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\9.0.0-dev\Sdk\BrowserWasmApp.targets(494,5): error MSB3073: The command "emcc "@C:\Users\username\source\repos\runtime-fork\artifacts\bin\dotnet-latest\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0-dev\runtimes\browser-wasm\native\src\emcc-default.rsp" -msimd128 "@C:\Users\username\source\repos\runtime-fork\artifacts\bin\dotnet-latest\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\9.0.0-dev\runtimes\browser-wasm\native\src\emcc-link.rsp" "@C:\Users\itomkowicz\source\repos\runtime-fork\artifacts\bin\Wasm.Build.Tests\Release\net9.0\win-x64\wbt artifacts\xpk1al41_fpx_├ÜÔöÉ├ç\obj\Debug\net9.0\wasm\for-publish\emcc-link.rsp"" exited with code 1.

see the comments below.

Reproduction:

Enable TestDataForDefaultTemplate_WithWorkload blocked by this issue. Run:

./dotnet.cmd build -bl ./src/mono/wasm/Wasm.Build.Tests/Wasm.Build.Tests.csproj -c Release -t:Test -p:XUnitClassName=Wasm.Build.Tests.Blazor.BuildPublishTests -p:TargetOS=browser -p:TargetArchitecture=wasm 

Metadata

Metadata

Assignees

Labels

arch-wasmWebAssembly architecturearea-Build-monodisabled-testThe test is disabled in source code against the issuein-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions