JetBrains Rider 2017.3 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.

JetBrains 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), JetBrains Rider suggests making the class static. In other cases JetBrains Rider suggests making the class abstract, if possible.

Note that due to the fact that JetBrains 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. In such cases, you can either suppress this inspection locally or disable it altogether.

Last modified: 19 April 2018

See Also