csharp-styleguide icon indicating copy to clipboard operation
csharp-styleguide copied to clipboard

C# 9 Top-Level Statements vs CA1812

Open Everest2020 opened this issue 3 years ago • 0 comments

After using the C# 9 feature Top-Level Statements, there is an error.

error CA1812: < Program >$ is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it static (Shared in Visual Basic).

It is already fixed in the official Roslyn-analyzers repo. see https://github.com/dotnet/roslyn-analyzers/pull/4066

Everest2020 avatar Jun 26 '21 06:06 Everest2020