razor icon indicating copy to clipboard operation
razor copied to clipboard

Suppress RZ10012

Open lonix1 opened this issue 3 years ago • 8 comments

In my blazor project, I get hundreds of RZ10012 warnings:

Found markup element with unexpected name 'Foo'. If this is intended to be a component, add a @using directive for its namespace.(RZ10012)

This seems to be a bug, going back for years. It's been reported dozens of times on SO and in various GitHub repos. There are no fixes or workarounds that work consistently.

It's impossible to be productive when the entire editor shows squigglies. Since the app itself works, I want to suppress that analyser rule.

So I added this to an .editorconfig in the project's root:

[*.razor]
dotnet_diagnostic.RZ10012.severity = none

That doesn't help. I also tried a .globalconfig file.

How can I suppress it?

(I'm using .net6 and vscode)

lonix1 avatar Oct 07 '22 01:10 lonix1

@allisonchou: Let's test this with the latest VS Code bits to see if it still repros there.

DustinCampbell avatar Nov 02 '22 22:11 DustinCampbell

It happened to me in Visual Studio 17.4 just today (not VS Code). In my case closing VS, deleting obj and bin directories and opening VS again, worked.

MihaMarkic avatar Nov 11 '22 08:11 MihaMarkic

For me, the rm -rf ./bin ./obj trick works sometimes, but even so, only for a few builds after which the problem returns. And I need to close and open vscode too.

lonix1 avatar Nov 11 '22 08:11 lonix1

It happens to me too, it is NOT USABLE AT ALL.

This is a very much urgent issue in my opinion. I simply can not keep coding like this.

Check this screen recording, it starts to blink on and off.

screencast-nimbus-capture-2023.01.13-18_56_58.webm

vgb1993 avatar Jan 13 '23 19:01 vgb1993

@phil-allen-msft I'm moving this back to triage since users are reporting this repros in both VS and VS Code. The last comment I believe is another instance of the colorization issues we've been seeing recently.

allisonchou avatar Jan 24 '23 20:01 allisonchou

@phil-allen-msft what was the rationale behind making this a compiler issue? Is there some more info somewhere about what’s causing it?

chsienki avatar Apr 26 '23 23:04 chsienki

Oh, I see this is about the suppression itself not working. Ok makes sense that that would be us.

chsienki avatar Apr 26 '23 23:04 chsienki

I still have the same issue on .NET 8 using C# and Blazor. Suppressing the RZ10012 warning still doesn't work via .editorconfig or the <NoWarn> tag in the .csproj file.

MrDoe avatar Feb 26 '24 09:02 MrDoe