ReSharper's solution-wide analysis enables two related but distinct features:
Solution-wide errors/warnings monitor, which lets you constantly keep track of all errors/warnings in your solution: both compiler errors/warnings and errors/warnings detected by ReSharper’s own inspections. This feature works together with the design-time code inspection and brings two advantages:
You do not have to open every file to make sure that your solution does not contain errors/warnings.
If you delete a public member or change its visibility, the code in the current file can still be correct, but what if this member is used somewhere else in the solution? For example, suppose that you changed the visibility of a member from
internal, assuming that it was only used inside the current project. At this stage, ReSharper finds no errors in the current file. Then, you switch on the solution-wide analysis , and actually there are errors. You can jump to the next error in solution and find out that someone uses this member from another project in your solution.
Solution-wide code inspections , which help find issues that can only be detected by analysing the whole solution (unused public types and members, unassigned public fields, suspicious type conversions etc.). When the solution-wide analysis is enabled, issues detected by the solution-wide inspections are highlighted in the opened files in the same way as other issues, and they also appear in the Inspection Results window when you run code inspection in specific scope.
Enabling solution-wide analysis
Solution-wide analysis can take some time for the initial processing of the solution and therefore, it is disabled by default. You should switch it on explicitly for every new solution you open.
To toggle solution-wide analysis
On the Enable code analysis checkbox is selected, and click Enable solution-wide analysis. Optionally, you can enable or disable warnings in the solution-wide analysis.page of ReSharper options, make sure that the
Click Save to apply the modifications and let ReSharper choose where to save them, or save the modifications to a specific settings layer using the Save To list. For more information, see managing and sharing resharper settings.
Alternatively, you can right-click the circle indicator in the right corner of the status bar and use the context menu to toggle the solution-wide analysis. If the solution-wide analysis is off, just double-click the gray circle.
After you have switched on the solution-wide analysis, several changes are made:
The status-bar indicator displays the progress of the analysis. After the analysis completes, the indicator turns green (if no errors/warnings were found), orange (if warnings in the solution-wide analysis are enabled and if there are warnings in the solution), or red (if errors were discovered):
A small area to the left of the circle indicator is allocated to show the number of solution files that contain errors/warning, if any. You can click this area to go to next error/warning in the solution.
Names and semantics of the navigation commands in the menu change. Specifically, Next Error/Warning changes to Next Error/Warning in Solution and Previous Error/Warning becomes Previous Error/Warning in Solution.
While the solution-wide analysis is enabled, you can use the status bar indicator to monitor errors/warnings in solution, but you can also get a detailed report on all errors/warnings in your solution in the Errors/Warnings in Solution window.
To view the list of errors found in solution
Do one of the following:
Choosein the main menu.
Right-click the circle indicator in the right corner of the status bar and choose Show Errors View from the drop-down list.
Double-click the circle indicator.
Either way, the Errors/Warnings in Solution window opens where you can view the list of detected errors/warnings and navigate to the related code by double-clicking the entries:
Even without opening this window, you can still easily navigate through errors in your solution with Alt+F12 / Shift+Alt+F12 (/ ), or just by clicking the number of errors/warnings to the left of the status bar indicator.
Performance of solution-wide analysis
The main calculations of the solution-wide analysis are performed when you first enable it. Depending on the size of your solution, these calculations may take from several seconds up to dozens of minutes. You will still be able to keep working, but some performance degradation is possible.
Once these global time-consuming calculations are finished, only necessary incremental analysis will be performed according to modifications.
When enabled, solution-wide analysis might also extensively use memory. If you notice that your system resources suffer too much, you can do one of the following:
- Configure the list of files, file masks, and folders to skip when performing code analysis.
- Edit the list of files and regions containing generated code to simplify analysis of such code.
- Pause the analysis when you do not need it and resume it only when you need it again.
- Exclude warnings from the analysis.
If you turn the solution-wide analysis off and then decide to turn it on again, ReSharper will have to repeat some of the initial calculations, which may be time-consuming. To avoid this, you can pause and resume the solution-wide analysis instead.
To pause and resume solution-wide analysis
On the toolbar of the Errors/Warnings in Solution window, click Pause Analysis or Continue Analysis .
Right-click on the circle indicator in the right corner of the status bar and then choose Pause Analysis or Continue Analysis in the context menu.
When warnings are enabled in the solution-wide analysis, it works as follows: as long as there are errors in the solution, only errors will be displayed; unresolved warnings will only appear when the last error is fixed. When warnings are disabled, the status bar indicator will turn green as soon as the last error is fixed.
To include/exclude warnings in solution-wide analysis
On the toolbar of the Errors/Warnings in Solution window, click Include/Exclude Warnings .
On the Include warnings checkbox under Enable solution-wide analysis.page of ReSharper options, use the
Ignoring errors in solution
At some stage of your solution development, you may have too many errors known to you. ReSharper allows you to flexibly ignore some errors or error-containing files and not include them into solution-wide analysis results.
Such items will be hidden from the error list in the Errors/Warnings in Solution window and they will not affect the state of the status bar indicator. When necessary, you can stop ignoring these items to display them.
To allow solution-wide analysis ignore specific errors/warnings
In the Errors/Warnings in Solution window, select a discovered problem or, if you want to ignore all issues in a specific file, select this file.
Click Ignore Error(s) on the toolbar.
To view the ignored errors, click Show Ignored errors on the toolbar — you will see all errors in the solution, the ignored items are shown as crossed out. Even if you choose to display ignored items in the list, they will not affect the status bar indicator.
To stop ignoring specific errors in solution
On the toolbar of the Errors/Warnings in Solution window, click Show Ignored errors .
Select an ignored item or file. Such items are shown as crossed out.
Click Stop Ignoring Error(s) to stop ignoring the selected item.
This feature is supported in the following languages and technologies:
The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section.