Skip to content
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

Closed
1 task
jkoritzinsky opened this issue May 19, 2023 · 5 comments · Fixed by #89945
Closed
1 task

[wasm] Random blazor build failures in WBT - error CS1001: Identifier expected #86533

jkoritzinsky opened this issue May 19, 2023 · 5 comments · Fixed by #89945
Assignees
Labels
arch-wasm WebAssembly architecture area-Infrastructure-mono Known Build Error Use this to report build issues in the .NET Helix tab
Milestone

Comments

@jkoritzinsky
Copy link
Member

jkoritzinsky commented May 19, 2023

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.

{
  "BuildRetry": false,
  "ErrorPattern": "error CS1001: Identifier expected.*blz",
  "ExcludeConsoleLog": false
}

Report

Build Definition Test Pull Request
361814 dotnet/runtime Wasm.Build.Tests.Blazor.BuildPublishTests.DefaultTemplate_CheckFingerprinting
353108 dotnet/runtime Workloads-NoWebcil-Wasm.Build.Tests.Blazor.MiscTests.WorkItemExecution #89529
351270 dotnet/runtime Workloads-Wasm.Build.Tests.Blazor.MiscTests.WorkItemExecution #89432
351073 dotnet/runtime Workloads-NoWebcil-Wasm.Build.Tests.Blazor.NoopNativeRebuildTest.WorkItemExecution #88279
339582 dotnet/runtime Workloads-Wasm.Build.Tests.Blazor.MiscTests.WorkItemExecution #88906

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
1 1 5

Known issue validation

Build: 🔎
Result validation: ⚠️ Validation could not be done without an Azure DevOps build URL on the issue. Please add it to the "Build: 🔎" line.
Validation performed at: 7/25/2023 11:54:35 PM UTC

TODO:

  • Add some debug bits to print the source file when such an error is encountered, since it is not reproducible easily.
@jkoritzinsky jkoritzinsky added arch-wasm WebAssembly architecture blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' Known Build Error Use this to report build issues in the .NET Helix tab labels May 19, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label May 19, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label May 19, 2023
@ghost
Copy link

ghost commented May 19, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

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.

{
  "ErrorMessage": "Wasm.Build.Tests.Blazor.MiscTests.NativeBuild_WithDeployOnBuild_UsedByVS(config: "Release", nativeRelink: False) [FAIL]",
  "BuildRetry": false,
  "ErrorPattern": "",
  "ExcludeConsoleLog": false
}
Author: jkoritzinsky
Assignees: -
Labels:

arch-wasm, blocking-clean-ci, Known Build Error

Milestone: -

@ghost
Copy link

ghost commented May 20, 2023

Tagging subscribers to this area: @directhex
See info in area-owners.md if you want to be subscribed.

Issue Details

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.

{
  "ErrorMessage": "Wasm.Build.Tests.Blazor.MiscTests.NativeBuild_WithDeployOnBuild_UsedByVS(config: "Release", nativeRelink: False) [FAIL]",
  "BuildRetry": false,
  "ErrorPattern": "",
  "ExcludeConsoleLog": false
}

Report

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0
Author: jkoritzinsky
Assignees: -
Labels:

arch-wasm, blocking-clean-ci, untriaged, area-Infrastructure-mono, Known Build Error, needs-area-label

Milestone: -

@vcsjones vcsjones removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label May 21, 2023
@radical
Copy link
Member

radical commented May 23, 2023

Blazor template tests sometimes fail with errors like:

 error CS1001: Identifier expected [/root/helix/work/workitem/e/wbt/blz_deploy_on_build_Release_False_szcqbvo4.for/blz_deploy_on_build_Release_False_szcqbvo4.for.csproj]
 error CS1002: ; expected [/root/helix/work/workitem/e/wbt/blz_deploy_on_build_Release_False_szcqbvo4.for/blz_deploy_on_build_Release_False_szcqbvo4.for.csproj]
 error CS1003: Syntax error, '(' expected [/root/helix/work/workitem/e/wbt/blz_deploy_on_build_Release_False_szcqbvo4.for/blz_deploy_on_build_Release_False_szcqbvo4.for.csproj]
 error CS1002: ; expected [/root/helix/work/workitem/e/wbt/blz_deploy_on_build_Release_False_szcqbvo4.for/blz_deploy_on_build_Release_False_szcqbvo4.for.csproj]
 error CS1026: ) expected [/root/helix/work/workitem/e/wbt/blz_deploy_on_build_Release_False_szcqbvo4.for/blz_deploy_on_build_Release_False_szcqbvo4.for.csproj]

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.

@radical radical added this to the 8.0.0 milestone May 23, 2023
@radical radical self-assigned this May 23, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label May 23, 2023
@radical radical removed the blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' label May 30, 2023
@radical radical changed the title Wasm.Build.Tests.Blazor.MiscTests.NativeBuild_WithDeployOnBuild_UsedByVS(config: "Release", nativeRelink: False) failing [wasm] Random blazor build failures in WBT - error CS1001: Identifier expected Jul 25, 2023
radical added a commit to radical/runtime that referenced this issue Jul 27, 2023
.. failure, where `Program.cs` fails to compile. In such a case make the
project contents available in the logs.

Issue: dotnet#86533
@radical
Copy link
Member

radical commented Jul 27, 2023

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.

@radical radical modified the milestones: 8.0.0, 9.0.0 Jul 27, 2023
radical added a commit that referenced this issue Jul 27, 2023
…lure (#89584)

.. failure, where `Program.cs` fails to compile. In such a case make the
project contents available in the logs.

Issue: #86533
@radical
Copy link
Member

radical commented Aug 3, 2023

Finally found the reason, thanks for the debug bits added earlier. It fails because we use the generated id in a source file, and that id happens to be invalid as a namespace.

using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using blz_checkfingerprinting_Release_zqkzgkui.ref;

See line 3! Fix incoming soon.

radical added a commit to radical/runtime that referenced this issue Aug 3, 2023
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 .
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Aug 3, 2023
radical added a commit that referenced this issue Aug 3, 2023
)

* [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
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Aug 3, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Infrastructure-mono Known Build Error Use this to report build issues in the .NET Helix tab
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants