Introducing ReSharper 5.0: Solution-Wide Warnings and Suggestions
Previous posts introducing ReSharper 5.0:
Over the years, ReSharper has gradually advanced from plainly highlighting errors and problems in individual code files to somehow summing up errors and problems in a larger scope, up to the entire solution.
Back in 2007, ReSharper 3.1 was the first product version to introduce Solution-Wide Error Analysis to gather data on all errors in the solution using a single tool window. ReSharper 4.5 split many code inspections to execute in private and public scope, with the latter only available when you turned on Solution-Wide Error Analysis.
Taking another huge step towards instantly seeing every problem anywhere in your solution, ReSharper 5 introduces a new code analysis feature called Solution-Wide Warnings and Suggestions. As you’ve probably guessed, it lists all warnings and suggestions that ReSharper displays in the scope of your whole solution or in a narrower scope, depending on how you call it. In other words, any code smells or other problems that you may have in your solution can now be summarized in a single tool window, making tool-based code review much easier.
When you switch on Solution-Wide Errors Analysis, Solution-Wide Warnings and Suggestions starts showing errors as well, plus warnings and suggestions that work in non-private scope.
That doesn’t mean Errors in Solution tool window becomes obsolete with R# 5: when your goal is as simple as to make your code compile, Errors in Solution quickly indicates that something in the solution went awfully wrong and you should fix things up before you can compile.
However, as soon as you’re ambitious enough to make your code green – that is, eliminate compiler warnings, implement best practices, or upgrade your code to leverage the latest language opportunities – Solution-Wide Warnings and Suggestions is exactly what you need to get the job done quickly.
The feature includes two items:
- Inspect Code – a new command that is available by right-clicking any node in Solution Explorer, from a single file to the whole solution:
- Inspection Results – a tool window that actually shows problems found in a certain scope, broken up into several categories:
The Inspection Results tool window is pretty much similar to other ReSharper tool windows like Type Hierarchy or Find Results: it provides common navigation, grouping and export options. It also has a code preview pane where you can instantly see the context of a problem without opening the corresponding file in the text editor:
In many scenarios, chances are you don’t want to review all code problems you may have in a scope – you’d rather focus on a particular subset. Inspection Results lets you do this by clicking the glaring Filter button:
This displays the Filter Issues dialog box where you can select or unselect individual inspections or even entire inspection groups. For example, here’s how you can discover code that can be transformed to leverage C# 3.0 and C# 4.0 language features:
When you double-click an item in Inspection Results, the corresponding file opens in the text editor in the right position for you to actually take measures: apply a quick-fix, refactor or clean up code, or whatever:
Of the three inspection items, two can be safely fixed using Code Cleanup, which can both delete a redundant “using” directive and make an explicitly typed variable implicitly typed. Then, you press Ctrl+Alt+F right on one of these two inspection items, and the Code Cleanup dialog box displays:
In addition to cleaning up code, you can also apply refactorings and navigation actions right from Inspection Results. I hope to cover scenarios involving this approach in subsequent posts about ReSharper 5.
To try out Solution-Wide Warnings and Inspections in its latest incarnation, make sure to download a fresh ReSharper 5 nightly build!
Subscribe to Blog updates
Thanks, we've got you!
Another Look into the Future with Rider’s Predictive Debugger
In the 2023.2 release cycle, we’ve introduced the Predictive Debugger in ReSharper, which gives you predictions about code paths and variables beyond the current execution pointer. We’ve written extensively about its advantages compared to alternative debugging strategies like thorough thinking, log…
Visualize Entity Framework Relationships and Additional Query Analysis in ReSharper 2023.3
A lot of teams are using Entity Framework or EF Core to work with their database. As an Object-Relational Mapper (ORM), it bridges objects in code to a relational database model, so that as a developer you don’t have to worry too much about the actual database. We all know: that’s not entirely tr…
Automatically Analyze ASP.NET Core Performance With Dynamic Program Analysis
Slow web pages may make your users or customers abandon your web application, even before they’ve had a proper look at it. You’ve likely also been frustrated working with a web application that is slow to load. The good news is that the latest versions of ReSharper and JetBrains Rider’s Dynamic P…
OSS Power-Ups: MassTransit – Webinar Recording
The recording of our webinar, OSS Power-Ups: MassTransit, with Chris Patterson, is available. This was the thirteenth episode of our OSS Power-Ups series, where we put a spotlight on open-source .NET projects. Subscribe to our community newsletter to receive notifications about future webinars.…