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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create a blazorwasm or blazor template project with name including emoji #41667

Open
1 task done
radical opened this issue Jun 18, 2024 · 6 comments
Open
1 task done
Labels
Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch Area-Templates Bug untriaged Request triage from a team member

Comments

@radical
Copy link
Member

radical commented Jun 18, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Project created with - dotnet new blazorwasm -o "blazorwasm_馃榾", fails to build with:

 $ dotnet build -bl
Restore complete (15.9s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  blazorwasm_馃榾 failed with errors (1.8s)
    /private/tmp/bl/blazorwasm_馃榾/Program.cs(3,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(9,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(10,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(9,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(10,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(9,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(10,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(9,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(10,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(9,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(10,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(9,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(10,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(9,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]
    /private/tmp/bl/blazorwasm_馃榾/_Imports.razor(10,7): error CS0246: The type or namespace name 'blazorwasm__' could not be found (are you missing a using directive or an assembly reference?) [/private/tmp/bl/blazorwasm_馃榾/blazorwasm_馃榾.csproj]

Build failed with errors in 17.9s

This was with .net sdk 9.0.100-preview.3.24157.9. It is also reproducible with 8.0.200.

Expected Behavior

No response

Steps To Reproduce

  1. dotnet new blazorwasm -o "blazorwasm_馃榾"
  2. cd "blazorwasm_馃榾"
  3. dotnet build

Exceptions (if any)

No response

.NET Version

No response

Anything else?

.log appended to the name to satisfy github.
msbuild.binlog.log

@javiercn
Copy link
Member

@radical does this not happen with other templates?

@radical
Copy link
Member Author

radical commented Jun 18, 2024

@radical does this not happen with other templates?

It happens with blazor template too. But it works fine with the console template. This sounds blazor specific as it is generating _Imports.razor:

...
@using blazor__
@using blazor__.Components

And the csproj has:

blazor_馃榾.csproj
    <RootNamespace>blazor_馃榾</RootNamespace>

@javiercn
Copy link
Member

@radical thanks for the additional details.

I think this might be a template bug? We are using the right template expression for the safe namespace bit https://github.com/dotnet/aspnetcore/blob/main/src/ProjectTemplates/Web.ProjectTemplates/BlazorWeb-CSharp.csproj.in#L9

@radical
Copy link
Member Author

radical commented Jun 19, 2024

Moving this to the sdk then.

@radical radical transferred this issue from dotnet/aspnetcore Jun 19, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch untriaged Request triage from a team member labels Jun 19, 2024
@radical radical changed the title Cannot create a blazorwasm template project with name including emoji Cannot create a blazorwasm or blazor template project with name including emoji Jun 19, 2024
@MackinnonBuck
Copy link
Member

@baronfel Do you know who can help out with this on the template engine side? We think we're doing everything necessary to generate safe names.

@baronfel
Copy link
Member

This is fascinating. When I create this template with -v diag here's the output I see for the name value forms:

[2024-06-20 11:51:05.482] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}identity' was assigned to value 'blazorwasm_馃榾'.
[2024-06-20 11:51:05.482] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}safe_name' was assigned to value 'blazorwasm___'.
[2024-06-20 11:51:05.482] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}lower_safe_name' was assigned to value 'blazorwasm___'.
[2024-06-20 11:51:05.482] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}safe_namespace' was assigned to value 'blazorwasm__'.
[2024-06-20 11:51:05.482] [Debug] [Template Engine] => [Execute] => [Template content generation]: [JoinMacro]: Variable 'name{-VALUE-FORMS-}lower_safe_namespace' was assigned to value 'blazorwasm__'.

To me, I look at this and think the same as you @MackinnonBuck - using the name{-VALUE-FORMS-}safe_namespace should get the useable name set on the RootNamespace. But that doesn't seem to be happening. So I'd say this is a bug in the engine, but we'd need to get a deeper investigation for full details. I'll see if we can find some more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch Area-Templates Bug untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

4 participants