ReSharper 2022.2 Comes With C# 11 Support, Solution-Wide Analysis Optimizations, and Virtual Formatter
We just released ReSharper 2022.2 and other JetBrains .NET tools and Visual Studio extensions. In this blog post, we’ll go through the highlights of this major update for ReSharper and ReSharper C++. To learn more about our other .NET tools, including dotCover, dotMemory, dotPeek, and dotTrace, please check out this separate blog post.
C# 11 support
This release brings support for several more features from the C# 11 preview:
- ReSharper 2022.2 is now aware of the required keyword for members inside a
recordtype, and provides additional support for the “required” keyword in code completion. We’ve also added a new Add initializer for required members quick-fix for cases where you’ve created a type’s object, but haven’t initialized the members yet.
- There are several more inspections and a context action to support
checkeduser-defined operators. ReSharper also shows all of the compiler errors and warnings.
- We’ve added basic “raw” string support including compiler errors and correct parsing and color highlighting for
“””syntax, pairs of double quotes, and placeholders inside interpolated strings (
- ReSharper 2022.2 fully supports list patterns with error checking, code completion, and code analysis. We are still working on adding code inspections to suggest using the list patterns in existing code and additional refactoring actions.
Solution-Wide Analysis optimizations
We’ve greatly optimized the memory usage of ReSharper with the Solution-Wide Analysis mode turned ON, both in terms of memory traffic (number of memory allocations) and memory consumption.
Before vs After
General C# code analysis improvements
- For those using top-level statements in their code, ReSharper 2022.2 adds the new context action To explicit ‘Program’ class to execute a transformation to the old style. It helps when the explicit startup
class Programis necessary or more desirable to use. We’ve also implemented a new Convert to top-level code context action.
- We reworked our
INotifyPropertyChangedsupport and supported more MVVM frameworks and
INotifyPropertyChangedbase classes. We now emit a
SetFieldmethod that enables the most concise syntax for
- We reviewed the most commonly used refactorings to increase their discoverability and introduced related context actions in the Alt+Enter menu that depend on the current context.
- There are more suggestions for using a
nameofoperator. ReSharper 2022.2 now recognizes the registrations of
DependencyPropertyin WPF projects and suggests using a
nameofoperator to capture the corresponding CLR property name. Built-in live templates were also updated to emit
nameofinstead of string literals.
- Quick-fixes which come from Structural Search And Replace patterns can now be applied in the scope of a file, folder, project, or entire solution.
We’ve introduced the Virtual Formatter — a way for you to view code in your desired formatting without actually reformatting the source code on the disk. For example, you can now virtually align parameters in columns or increase indents. Our goal with this feature is to improve code readability and maintainability and make it more accessible for visually impaired and neurodivergent developers.
You can now remove temporary files generated by ReSharper while it is working on your code. There is a new Disk Cleanup page in Options to manage the default paths, files, and custom path templates and to set up and run automatic or manual cleanup.
- ReSharper can now detect if the StyleCop.Analyzers package is referenced by a project and read its settings from the
- The way ReadyToRun (R2R) and NGen assemblies are presented in the Assembly Explorer has been improved. A small processor symbol icon and
R2Rlabels are now displayed next to each assembly’s name. The Metadata tree has the ReadyToRun header.
If you are eager to learn more about all these ReSharper features, please visit the What’s New page. You may also want to review the full list of requests we’ve addressed this release cycle in our public bug tracker.
ReSharper C++ now reads Blueprints and introduces a new type of hint to help you see how Blueprint designers use and extend the baseline system implemented in the C++ part of your Unreal Engine game. With the new Blueprint hints, you’ll be aware of derived Blueprint classes,
UFunction implementations, and the write access to and default values of
Among other improvements, the indexing speed of Unreal Engine code has been significantly increased. As a result of caching precompiled headers, ReSharper C++ now indexes the engine code up to twice as fast as before.
For more details, please see this dedicated blog post.