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
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 the using import removed for the following line:
app.MapRazorComponents<App>();
If I add a GlobalUsings declaration in my unit tests project, it no longer seems to happen.
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 #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!
jonashendrickx
changed the title
dotnet format incorrectly removing using directives of Blazor/Razor components since 8.0.201
dotnet format incorrectly removing using directives of Blazor/Razor components since 8.0.2
Feb 19, 2024
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.
The text was updated successfully, but these errors were encountered: