The majority of code inspection only need the source code of a single file to work and detect code issues. In addition to these inspections, ReSharper provides solution-wide warnings and suggestions, that target code issues only detectable in scope of entire solution:
- They only work when the solution-wide analysis is enabled..
- Most of them help detect unused non-private members (see the list below for details).
These issues are
in the opened files in the same way as other issues, and they also appear in the
window when you
run code inspection in specific scope.
However, they do not appear in the
Errors in Solution
Similar to any other inspection, you can change severity level of a solution-wide inspection in the ReSharper | Options | Code Inspection | Settings. However, changing severity of a solution-wide inspection to error doesn't necessarily mean that such inspection will appear in the Errors in Solution 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.
If you are not interested in code issues detected with a specific inspection, press Alt+EnterAlt+Enter while you at the issue and select Options for inspection. Then you can choose to disable the corresponding code inspection with a comment or change its severity level to Do not show.
- Ignoring Errors in Solution
- Enabling Solution-Wide Analysis
- Viewing Errors in Solution
- Code Annotations