Dotnet logo

.NET Tools

Essential productivity kit for .NET and game developers

How-To's

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.

Technorati tags: c#, Visual Studio, ReSharper, ReSharper 3.1, Solution-Wide Analysis, Solution-Wide Error Analysis, ReSharper in Detail
image description

Discover more