Rider Help

Code Inspection: Class is never instantiated (non-private accessibility)

This is a solution-wide code inspection. It only works when the solution-wide analysis is enabled.

Rider determines if no objects of a class were created in a project — in fact, if no direct instances or usages of the class were found. If the class only contains static members (and/or constant fields), Rider suggests making the class static. In other cases Rider suggests making the class abstract, if possible.

Note that due to the fact that Rider only detects direct instantiation or usage, it will issue this warning even in cases when the class is, in fact, being used, but is instantiated indirectly — for example, via reflection or a dependency injection container.

Last modified: 11 October 2017

See Also