ReSharper 2022.3

Adiciona suporte para os recursos mais recentes do C# 11, incluindo literais UTF-8, tipos de arquivo local e membros virtuais estáticos.
Dezembro 12, 2022
Nova versão

Recursos

C# 11

  • UTF-8 literals - 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 - Added basic support for file-local types which 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 - 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 Microsoft .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 now 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

  • Introduced 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 - Added a new gutter mark icon to notify users about implicit namespace imports in C# and Razor files.
  • Format string completion - With the addition of Int128 and UInt128 numeric types in .NET 7, code completion format specifier suggestions have been updated. Missing support for DateOnly and TimeOnly date/time types from .NET 6 has also been added, as well as the 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 have 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. Vulnerable dependency detection has been added in ReSharper. Starting with this release, any affected dependencies will be highlighted in .csproj and .vbproj files.

Support for Microsoft Visual Studio 2022 ARM64

  • ReSharper can now be integrated into Microsoft Visual Studio on ARM-powered devices. Initial support is being provided 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 Microsoft Windows ARM64

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

Decompiler

  • Embedded decompiler in ReSharper now 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 Microsoft Entity Framework Core and a .NET data provider for Microsoft SQL Server.

C++20 modules

  • ReSharper C++ adds experimental support for C++20 modules. The language engine and many of the ReSharper C++ features have been updated to work with the new compilation model, supporting both named modules and header units.

Clang-format integration

  • ReSharper C++ now 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.
File-local types

ReSharper

Aumente sua produtividade de .NET.

ReSharper também está disponível em:

Tem alguma pergunta?

Chat ao vivo com nossos especialistas de licenciamento de JetBrains.