We have a C# application where we have the Program.cs file with the main method as an entry point. Why is SonarAnalyzer flagging this file and recommends adding a protected constructor or add the static keyword to the program class since this is not a utility class?
Question about S118 - Utility classes should not have public constructors....Should this flag the Program.cs file in C#
The idea is that your
Program class is not intended to be instantiated by other classes. To make this clear, you should make your
static or you should add a private/protected constructor. It’s just a way of making things clear using the language itself rather than adding comments.