What’s new in ReSharper 2022.3

ReSharper 2022.3 introduces basic support for the latest C# 11 features, including UTF-8 literals, file-local types, static virtual members, pattern matching over spans, and others. For this release, we’ve reworked code highlighting, introduced vulnerable dependency detection for NuGet packages, and enabled importing and exporting type and project dependency diagrams in the GraphML format. This version also comes with early support for Microsoft Visual Studio running on ARM64.

Download

Free 30-day trial available

C# 11

We are finalizing basic support for the latest C# 11 features:

UTF-8 literals

We’ve added basic support for UTF-8 literals. The code analysis now suggests using a u8 suffix for a literal instead of the System.Text.Encoding.UTF8.GetBytes() method or a byte array with proper UTF8 symbols. There is also a set of compiler warnings and errors for UTF-8 literals.

File-local types

Basic support for file-local types includes understanding of the new syntax, a file accessibility modifier for types, and compiler warnings and errors with corresponding quick-fixes, like Move class to outer scope when the file modifier is specified for a nested class. There is also a useful context action to convert a general type to a file one.

Raw strings

ReSharper can now convert regular and verbatim strings into their raw counterparts. This also means that numerous existing features for strings are now available for raw strings.

List pattern suggestions

In this release, we’ve introduced suggestions to use the new C# 11 list pattern syntax (instead of conventional collection length checks with subsequent indexer access expression) to check the corresponding items of the collection.

Static virtual members

Starting from C# 11, you can use abstract and virtual modifiers for static members in interfaces and use such members in generic code with type parameters constrained by this interface. ReSharper has been updated to handle polymorphic static members the same way ordinary polymorphic members are handled:

  • Inheritance marks on the gutter.
  • Navigation to implementing/super members.
  • Generation of missing implementations.
  • Code completion suggestions after the override keyword also include interface members, so now you can easily implement abstract or virtual static members.

Unsigned right shift (>>>) operator

ReSharper now recognizes the cumbersome code pattern that C# developers have to write to perform an unsigned right shift for signed data types and suggests using the unsigned right shift (>>>) operator in C# 11 instead.

Pattern matching over spans

If you parse Spans of characters you probably use the MemoryExtensions.SequenceEqual method a lot. C# 11 introduces a shorthand for this kind of check. You can now simply pattern-match Spans of characters against string literals with is or switch expressions.

ReSharper now suggests using is or switch expressions instead of lots of if statements.

ref fields and scoped keyword

Starting from C#11, you are allowed to declare ref fields inside ref structs. ReSharper supports this new syntax rule, provides all compiler errors and warnings, shows a ref keyword in the code completion, and allows such fields to be initialized in a constructor.

ReSharper is also aware of a new scoped keyword which you can use on by-ref or ref struct arguments and local variables. The support includes correct parsing of the new syntax, the scoped keyword in code completion, and preservation of the scoped keyword when generating method overrides. It also verifies the compatibility of scoped modifiers and offers quick fixes for mismatched scoped parameters on overrides, interface implementations, and delegate conversions.

C# 11 and .NET 7 also introduced changes in the language's ref safety rules. The changes govern what operations are available for by-ref and ref struct variables in order to provide ref safety in managed code with the introduction of ref fields. ReSharper is aware of the changes and will help you find the parts of your project that need to be updated and annotated with the new scoped keyword to accommodate the changes when migrating to C# 11 or .NET 7.

Language injections

With the 2022.3 release, we are introducing a couple of changes to the support for language injections:

Language injections now work inside C# 11 raw string literals.

ReSharper supports the [StringSyntax] attribute from .NET 7, along with its different syntaxes for language injection and code completion.

General C# updates

Global imports gutter mark

There is a new gutter mark icon to notify users about implicit namespace imports in C# and Razor files.

By hitting Alt+Enter on the corresponding line, you can observe the full list of implicit imports and information about the source file where the corresponding global using directives are located. If you select a particular imported namespace, ReSharper can navigate you to where it's declared, including navigation to <Using Include="Some.NameSpace" /> tags in the .csproj project file.

ReSharper also presents global imports from _Imports.razor and allows navigation to corresponding import definitions.

Format string completion

With the addition of Int128 and UInt128 numeric types in .NET 7, we've updated our code completion format specifier suggestions.

We’ve also added missing support for DateOnly and TimeOnly date/time types from .NET 6, as well as the Half half-precision floating point numeric type introduced in .NET 5.

Trivial patterns to expressions

Sometimes after refactoring, your pattern-matching expressions may turn into trivial recursive patterns. At this point it may not be worthwhile to use the recursive pattern syntax at all, so ReSharper now offers the action of rewriting patterns into simpler expressions while preserving the original pattern-matching semantics.

Code completion hints for a void expression

Sometimes when you type after an invocation, you see hardly any meaningful suggestions. This can happen if the invocation resulted in no value being produced when the void-returning method was invoked. Usually it takes a few IDE actions to realize that (going back and navigating to the method declaration, or hovering the mouse over the invocation). In this release we’ve introduced the void hint item over this type of void-returning invocation to give you immediate feedback about the type resulting from the invocation. Accepting this void item will add a semicolon after the invocation if the semicolon is missing.

Code highlighting

Code highlights and squiggles in ReSharper 2022.3 received an overhaul. Due to a difference in internal logic, ReSharper used to come into conflict with Microsoft Roslyn’s code style analyzers, causing it to display overlapping highlighting, draw the same highlight in different spots, or double the squiggles. The differences in logic behind the majority of such instances have now been resolved, and for the rare outlier cases, there are errors with clear suggestions on how to resolve the conflict.

Security

Whenever you’re using open-source NuGet packages in your solutions, there’s a risk of opening your project up to security vulnerabilities. While there are outside tools NuGet provides to screen for such threats, it’s infinitely more convenient to have a tool like that right in your IDE to catch any vulnerabilities during design time. That’s why we're introducing vulnerable dependency detection in ReSharper. Starting with this release, any affected dependencies will be highlighted in .csproj and .vbproj files.

Support for Visual Studio 2022 ARM64

ReSharper can be integrated into Microsoft Visual Studio on ARM-powered devices. We’re providing initial support for all basic development workflows except spell-checking with ReSpeller.

The installer has been updated to include support for both x64 and ARM64. The correct version will automatically be installed in accordance with the processor architecture of your machine.

Support for Windows ARM64

dotPeek, dotMemory, dotTrace, and dotCover, as well as ReSharper command-line tools, now support Windows ARM64.

Decompiler

Embedded decompiler in ReSharper 2022.3 comes with support for:

  • static abstract and static virtual members in interfaces;
  • generic attributes;
  • user-defined checked operators;
  • unsigned right shift operator.

IL Viewer

The IL Viewer tool window is now able to decompile code into different levels of C# language constructs. There are two C# levels available: high-level, with certain syntax constructs simplified using the latest language features, and low-level, for cases when you want to know how these syntax constructs are desugared.

Dependency diagrams

ReSharper now allows you to save and import type and project dependency diagrams in the GraphML format, preserving the ability to use the diagram as a code map and to navigate through dependencies quickly.

Dynamic Program Analysis

Dynamic Program Analysis (DPA) has new inspections that let you find various issues related to database usage, namely:

  • Long command execution times
  • Too many database connections
  • Too many simultaneously executed database commands
  • Commands returning too many records

The new inspections are available for all applications that use Entity Framework Core and a .NET data provider for SQL Server.

C++20 modules

ReSharper C++ 2022.3 adds experimental support for C++20 modules. We've updated the language engine and many of the ReSharper C++ features to work with the new compilation model, supporting both named modules and header units.

What’s New in ReSharper C++ 2022.3

Clang-format integration

ReSharper C++ 2022.3 provides seamless integration with clang-format. You can now switch between ReSharper’s own formatting engine and the built-in or a custom clang-format binary for formatting files. ReSharper C++ runs clang-format in a separate process, ensuring full compatibility with the industry-standard formatter, as well as better performance and a more extensive range of formatting options.

Download

Free 30-day trial available