Open jonashendrickx opened 9 months ago
Even the default Blazor templates are broken when adding the .editorconfig
from dotnet/roslyn
or dotnet/aspnetcore
.
Folder structure: --Program.cs --Components/App.razor
The documentation does not seem to suggest that both files have to be in the same folder.
Cross-posted from https://github.com/dotnet/format/issues/2119
When I build locally I see the following error:
Source/passwordless-server/src/AdminConsole/Program.cs(212,28): error CS0246: The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?)
I think it is related to https://github.com/dotnet/roslyn/issues/72015. Roslyn wasn't cleanly loading Blazor projects which would lead to some using directives appearing to be unused. This should be fixed in the next released SDKs.
@JoeRobich Thank you for pointing me in the right direction! Very much appreciated!
Version Used:
.NET 8.0.201
Steps to Reproduce:
dotnet format
I've also attempted to remove lines from
_imports.razor
, but that didn't seem to make a difference.Diagnostic Id:
If this is a report about a bug in an analyzer, please include the diagnostic if possible (e.g.
"IDE0030"
).Expected Behavior:
It should not happen.
Actual Behavior:
When running dotnet format, it seems to remove all the usings everywhere in my unit tests where I do not have a GlobalUsings.cs file.
My _Imports.razor:
It would remove the using clauses in my unit test project of the lines above. Is this expected behavior? It was not happening in .NET 8.0.1 or .NET 8.0.0.
In
Program.cs
I am also seeing theusing
import removed for the following line:If I add a GlobalUsings declaration in my unit tests project, it no longer seems to happen.