Solution-Wide Analysis Explained

As announced before, ReSharper 3.1 provides a new full-fledged feature called Solution-Wide Analysis, which looks for erroneous C# code in your solution on-the-fly, without compiling it first.
 
So how does it work?
 
Suppose that you changed the visibility of a member from public to internal, assuming that it was only used inside the current assembly. At this stage, ReSharper finds no errors in the current file. Then, you switch on Solution-Wide Analysis and the circle indicator in the status bar turns red. You jump to the next error in solution and you find out that someone used this member from outside of the current assembly. You make necessary amendments, and that’s all! No need to compile, then look for errors, then fix them, and finally repeat the whole process over and over again.
 
Initial analysis may take some time to complete while you continue your work, but after it is done, only files that can potentially be affected by recent changes are reanalyzed.
 
Note that this feature is disabled by default and should be explicitly configured for every new solution you use.
 
To switch Solution-Wide Analysis on, just double-click the gray circle in the right corner of the status bar. After that, when the Solution-Wide Analysis tab displays in the Options dialog box, select Analyze errors in whole solution.

 
ReSharper Options dialog box: Code Inspection: Solution-Wide Analysis
 
Switching on Solution-Wide Analysis is signified by several changes in UI:

  • The circle indicator in the right corner of the status bar displays the progress of Solution-Wide Analysis. Initially, it is gray, but after analysis is complete, the indicator turns either green (if no solution-wide errors were found) or red (if errors were detected).
  • A small area to the left of the circle indicator is allocated to show the number of solution files that contain errors, if any.
  • Names of several Go to commands are extended. Specifically, Go to Next Error changes to Go to Next Error in Solution and Go to Previous Error becomes Go to Previous Error in Solution.

To view the list of errors found in solution, double-click the circle indicator. The Errors in Solution window opens where you can view the list of detected errors and navigate to them in code by double-clicking their respective descriptions.
 
ReSharper windows: Errors in Solution
 
Even without opening that window, you can still easily navigate through errors in your solution with Go to Next Error in Solution (Alt+Shift+Page Down or Alt+F12) and Go to Previous Error in Solution (Alt+Shift+Page Up or Shift+Alt+F12) commands.
 
You might also like to know what others have to say about this wonderful new feature:
Brian Di Croce reviews ReSharper 3.1
Ilya Ryzhenkov, .NET Tools Product Manager at JetBrains, reviews an earlier version of Solution-Wide Analysis and answers your questions
Jonas Bandi emphasizes the role of Solution-Wide Analysis as a means to differentiate between developing and building solutions. So do Jean-Paul S. Boodhoo and Joey Beninghove.

This entry was posted in How-To's, Links and Opinions, ReSharper Tips&Tricks and tagged . Bookmark the permalink.

2 Responses to Solution-Wide Analysis Explained

  1. matt says:

    are there plans to add solution-wide warnings?

  2. Jura Gorohovsky says:

    Hi Matt,
    Sorry for late answer.
    We plan to implement that sometime in future but no certain schedule is there yet. Anyway, R# 4.0 won’t provide this feature.
    Still, you can customize inspection severity (ReSharper > Options > Code Inspection > Inspection Severity) to make SW Error Analysis display certain warnings as errors in solution. That is not exactly what this feature is intended for, but anyway..

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>