This documentation is archived and is not being maintained.

Avoid uninstantiated internal classes







Breaking Change


An instance of an assembly-level type is not created by code within the assembly. The following types are not examined by this rule:

  • Value types.

  • Abstract types.

  • Enumerations.

  • Delegates.

  • Compiler-emitted array types.

  • Uninstantiable types that define static methods only.

This rule tries to locate a call to one of the type's constructors, and reports a violation if no call is found.

To fix a violation of this rule, remove the type, or add the code that uses it. If the type contains only static methods, add one of the following to the type to prevent the compiler from emitting a default public instance constructor:

  • A private constructor (for types targeting .NET Framework versions 1.0 and 1.1).

  • The static modifier (for types targeting .NET Framework 2.0).

It is safe to exclude a warning from this rule, but there are no known scenarios where this is required.