-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wasm] Random blazor build failures in WBT - error CS1001: Identifier expected
#86533
Comments
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsBuild InformationBuild: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=280353 Error MessageFill the error message using known issues guidance. {
"ErrorMessage": "Wasm.Build.Tests.Blazor.MiscTests.NativeBuild_WithDeployOnBuild_UsedByVS(config: "Release", nativeRelink: False) [FAIL]",
"BuildRetry": false,
"ErrorPattern": "",
"ExcludeConsoleLog": false
}
|
Tagging subscribers to this area: @directhex Issue DetailsBuild InformationBuild: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=280353 Error MessageFill the error message using known issues guidance. {
"ErrorMessage": "Wasm.Build.Tests.Blazor.MiscTests.NativeBuild_WithDeployOnBuild_UsedByVS(config: "Release", nativeRelink: False) [FAIL]",
"BuildRetry": false,
"ErrorPattern": "",
"ExcludeConsoleLog": false
} ReportSummary
|
Blazor template tests sometimes fail with errors like:
But it's not clear what code was generated that failed to compile here. I will add some debug bits to get more info in future failures. |
error CS1001: Identifier expected
.. failure, where `Program.cs` fails to compile. In such a case make the project contents available in the logs. Issue: dotnet#86533
This happens rarely, and isn't reproducible locally. #89584 adds some debug bits so the next time it fails, we can get some info to help debugging it. |
Finally found the reason, thanks for the debug bits added earlier. It fails because we use the generated using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using blz_checkfingerprinting_Release_zqkzgkui.ref; See line 3! Fix incoming soon. |
For every test project, a random id is used which is `Path.GetRandomFileName()`. In some cases this `id` gets used in a generated C/C# source file, and that can cause failures. For example the following fails with: ``` blz_checkfingerprinting_Release_zqkzgkui.ref/Program.cs(3,48): error CS1001: Identifier expected [/root/helix/work/workitem/e/wbt/blz_checkfingerprinting_Release_zqkzgkui.ref/blz_checkfingerprinting_Release_zqkzgkui.ref.csproj] blz_checkfingerprinting_Release_zqkzgkui.ref/Program.cs(3,48): error CS1002: ; expected [/root/helix/work/workitem/e/wbt/blz_checkfingerprinting_Release_zqkzgkui.ref/blz_checkfingerprinting_Release_zqkzgkui.ref.csproj] blz_checkfingerprinting_Release_zqkzgkui.ref/Program.cs(3,51): error CS1031: Type expected [/root/helix/work/workitem/e/wbt/blz_checkfingerprinting_Release_zqkzgkui.ref/blz_checkfingerprinting_Release_zqkzgkui.ref.csproj] ``` because the id, `blz_checkfingerprinting_Release_zqkzgkui.ref`, was used as a namespace (line 3). ``` using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using blz_checkfingerprinting_Release_zqkzgkui.ref; ``` Fix up the generated random ids to make them safer. The code is taken from `WasmAppBuilder/ManagedToNativeGenerator.cs`. Fixes dotnet#86533 .
) * [wasm] WBT: Use project ids that are safe for use as identifiers For every test project, a random id is used which is `Path.GetRandomFileName()`. In some cases this `id` gets used in a generated C/C# source file, and that can cause failures. For example the following fails with: ``` blz_checkfingerprinting_Release_zqkzgkui.ref/Program.cs(3,48): error CS1001: Identifier expected [/root/helix/work/workitem/e/wbt/blz_checkfingerprinting_Release_zqkzgkui.ref/blz_checkfingerprinting_Release_zqkzgkui.ref.csproj] blz_checkfingerprinting_Release_zqkzgkui.ref/Program.cs(3,48): error CS1002: ; expected [/root/helix/work/workitem/e/wbt/blz_checkfingerprinting_Release_zqkzgkui.ref/blz_checkfingerprinting_Release_zqkzgkui.ref.csproj] blz_checkfingerprinting_Release_zqkzgkui.ref/Program.cs(3,51): error CS1031: Type expected [/root/helix/work/workitem/e/wbt/blz_checkfingerprinting_Release_zqkzgkui.ref/blz_checkfingerprinting_Release_zqkzgkui.ref.csproj] ``` because the id, `blz_checkfingerprinting_Release_zqkzgkui.ref`, was used as a namespace (line 3). ``` using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using blz_checkfingerprinting_Release_zqkzgkui.ref; ``` Fix up the generated random ids to make them safer. The code is taken from `WasmAppBuilder/ManagedToNativeGenerator.cs`. Fixes #86533 . * Apply the same for wasi
Build Information
Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=280353
Build error leg or test failing: Wasm.Build.Tests.Blazor.MiscTests.NativeBuild_WithDeployOnBuild_UsedByVS
Pull request: #86519
Error Message
Fill the error message using known issues guidance.
Report
Summary
Known issue validation
Build: 🔎⚠️ Validation could not be done without an Azure DevOps build URL on the issue. Please add it to the "Build: 🔎" line.
Result validation:
Validation performed at: 7/25/2023 11:54:35 PM UTC
TODO:
The text was updated successfully, but these errors were encountered: