You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Razor's source generator adds the RootNamespace MSBuild property to the list of CompilerVisibleProperty. It uses this to calculate namespace for the generated types. In the GeneratedMSBuildEditorConfig.editorconfig, the value that gets written to is build_property.RootNamespace = C#_blazorwasm. The value that the source generator reads it is C which results in a bunch of code generation errors.
For some file metadata read by the source generator, our SDK currently does some custom encoding to avoid this issue. I'd like to avoid doing this for this metadata because the issue isn't unique to Razor and other SG authors are also likely to get in to trouble because of it.
Original issue description:
Steps to Reproduce
Using .NET sdk 6.0.100-rc.2.21471.7
mkdir C#_blazorwasm
cd C#_blazorwasm
dotnet new blazorwasm
dotnet build
Actual Results
Project fails to build
Microsoft (R) Build Engine version 17.0.0-preview-21378-03+d592862ed for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
d:\test\blazor\C#_blazorwasm\Pages\Index.razor(7,1): warning RZ10012: Found markup element with unexpected name 'SurveyPrompt'. If this is intended to be a component, add a @using directive for its namespace. [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
D:\test\blazor\C#_blazorwasm\Program.cs(2,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
Build FAILED.
d:\test\blazor\C#_blazorwasm\Pages\Index.razor(7,1): warning RZ10012: Found markup element with unexpected name 'SurveyPrompt'. If this is intended to be a component, add a @using directive for its namespace. [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
D:\test\blazor\C#_blazorwasm\Program.cs(2,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(9,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
d:\test\blazor\C#_blazorwasm\_Imports.razor(10,7): error CS0246: The type or namespace name 'C__blazorwasm' could not be found (are you missing a using directive or an assembly reference?) [D:\test\blazor\C#_blazorwasm\C#_blazorwasm.csproj]
1 Warning(s)
17 Error(s)
Excepted Results
Project builds cleanly with no errors.
The text was updated successfully, but these errors were encountered:
pranavkm
changed the title
blazorwasm project fails to build when project name contains a '#'
Values in CompilerVisibleProperty containing #s don't transfer to source generators
Sep 23, 2021
Razor's source generator adds the
RootNamespace
MSBuild property to the list ofCompilerVisibleProperty
. It uses this to calculate namespace for the generated types. In theGeneratedMSBuildEditorConfig.editorconfig
, the value that gets written to isbuild_property.RootNamespace = C#_blazorwasm
. The value that the source generator reads it isC
which results in a bunch of code generation errors.For some file metadata read by the source generator, our SDK currently does some custom encoding to avoid this issue. I'd like to avoid doing this for this metadata because the issue isn't unique to Razor and other SG authors are also likely to get in to trouble because of it.
Original issue description:
Steps to Reproduce
Actual Results
Project fails to build
Excepted Results
Project builds cleanly with no errors.
The text was updated successfully, but these errors were encountered: