Skip to content

Conversation

@radical
Copy link
Member

@radical radical commented 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 #86533 .

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 .
@radical radical added the arch-wasm WebAssembly architecture label Aug 3, 2023
@ghost
Copy link

ghost commented Aug 3, 2023

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

Issue Details

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 .

Author: radical
Assignees: -
Labels:

arch-wasm

Milestone: -

@ghost ghost added the area-Build-mono label Aug 3, 2023
@ghost ghost assigned radical Aug 3, 2023
@radical radical requested review from lewing and pavelsavara August 3, 2023 17:06
@radical radical requested a review from marek-safar as a code owner August 3, 2023 17:12
@radical radical merged commit 2699015 into dotnet:main Aug 3, 2023
@radical radical deleted the fix-ids-in-wbt branch August 3, 2023 22:50
@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-Build-mono

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants