Why can't I suppress a CA violation with the latest .NET 5 and NetAnalyzers?

Viewed 123

I upgraded a project to .NET 5, installed the latest Microsoft.CodeAnalysis.NetAnalyzers, and I have this in my .editorconfig file:

dotnet_diagnostic.CA1506.severity = error

Why can I not suppress this?

In the error list, there is no option to suppress when I right-click the error.

So I added this attribute manually to the method:

[SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "Existing class that matches every other project. This error is more important for business logic and not setup.")]
public IServiceProvider ConfigureServices(IServiceCollection services)

Yet I get the error every time I compile. What am I missing?

Edit: I closed VS and reopened it and now the error is gone. Certainly that can't be the answer, can it?

Edit 2: I can hover over a different warning and choose to suppress it, but not CA 1506.

0 Answers
Related