In addition to traditional warnings and suggestions, ReSharper provides solution-wide warnings and suggestions:
- They only work when you let ReSharper analyze your whole solution.
- Most of them help detect unused non-private members on-the-fly (see list below for details).
- They are only displayed in code and on the
Marker Bar, not in
the Errors in Solution tool window.
NoteSimilar to any other inspection, you can change severity level of a solution-wide inspection in the ReSharper | Options | Code Inspection | Inspection Severity tab. However, changing severity of a solution-wide inspection to error doesn't necessarily mean that such inspection will appear in the Errors in Solution tool window.
As usual, for any such warning or suggestion, ReSharper provides one or several quick-fixes.
Specifically, solution-wide warnings and suggestions help you discover:
- Unused non-private type or member declarations:
- Unused return values of non-private methods.
- Unused parameters in non-private members.
- Unassigned fields.
- Unaccessed non-private fields.
- Members and types that can be made internal, private or protected instead of public:
- Non-private classes that can be made sealed.
- Non-private classes or members that can be made static.
- Non-private local variables or fields that can be converted to constants.
- Non-private fields that can be made read-only:
- Non-private classes with never overridden virtual members.
- Non-private events that are never subscribed to.
- Abstract or virtual events that are never invoked:
- Auto-implemented non-private property accessors that are never used.
- Suspicious type conversions or checks.
- Non-private type members that are never used via base type or interface
- Non-private type members that are only accessed from overrides
- Parameters of non-private methods that can be declared with IEnumerable<T> type
- Non-private methods that can have IEnumerable<T> return type
- Redundant method overloads
- Non-static classes that are never instantiated
In addition, two code annotations, UsedImplicitlyAttribute and MeansImplicitUseAttribute, are available to mark certain non-private types and members if they are left unused intentionally, which prevents ReSharper from warning about them.