C#


ROSLYN.DESIGN.CA1012 : Abstract types should not have public constructors (C#)

See Roslyn-Detected C# Warning Classes for more information.

Summary

Constructors on abstract types can be called only by derived types. Because public constructors create instances of a type, and you cannot create instances of an abstract type, an abstract type that has a public constructor is incorrectly designed.

This check corresponds to Roslyn rule CA1012. For full rule details, see the Microsoft website: CA1012.

Properties

Class Name Abstract types should not have public constructors (C#)
Significance reliability
Mnemonic ROSLYN.DESIGN.CA1012
Categories None
Availability Available for C# only.
Enabling Checks for this warning class are disabled by default. To enable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += allow class="Abstract types should not have public constructors (C#)"

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.