What’s new in ReSharper 2023.2

ReSharper 2023.2 offers improved support for C#, featuring new inspections for working with local functions, raw strings, and resolving common Entity Framework issues. This release also brings support for C++ refactoring and more C++20 and C++23 features. Among the features that make their debut in ReSharper 2023.2 is the ability to easily create and navigate through unit tests, predictive debugger mode, and the new AI Assistant.

Download

Free 30-day trial available

Key updates

Improved C# support

Improved C# support

ReSharper 2023.2 brings new code inspections and quick-fixes for working with raw string literals and local functions, as well as for handling common Entity Framework issues and redundant nullable directives. Early support for C# 12 covers primary constructors and lambda expressions with optional parameters. We've also improved ReSharper's support for discards and disposable resources and added new inline and interline hints.

Learn more

Navigating and Creating Unit Tests

ReSharper’s Unit Testing receives a major update with the addition of a feature that lets you navigate and create tests for your production code!

To create a test, just invoke the Generate Code action, and choose Unit Test or hit Ctrl+U,C. ReSharper lets you choose the test class name and will even create a new project with your preferred testing framework (if it’s not already in place). Once the test is created, you can navigate between your implementation and test code using the Navigate To action or by hitting Ctrl+U,F.

Learn more

AI Assistant

AI Assistant Limited access

The 2023.2 versions of IntelliJ-based IDEs and .NET tools introduce a major new feature: AI Assistant. The initial set of AI-powered features offers an integrated AI chat and weaves naturally into some of the core development workflows via context actions, making it possible for AI Assistant to explain selected pieces of code, weed out potential issues, and generate XML documentation for you.

Learn more

C# support

Improved support for raw strings

We added new C# inspections and context actions for working with raw strings, as well as improved typing assists and new formatting options:

  • A Use raw string inspection to transform multi-line verbatim strings into their raw representations.
  • A Simplify raw string inspection to remove some of the quotes and dollar sign symbols that become redundant.
  • A number of context actions to add or remove quotes, interpolation braces, and dollar sign symbols and to switch between single-line and multi-line representation.
  • Several code formatter options, allowing you to align or indent the content inside raw strings.
  • Improved typing assistance on clicking the Enter, Delete, or Backspace keys.

Check out the corresponding blog post to learn more about our improved support of raw strings.

Inspections for common Entity Framework issues

Inspections for common Entity Framework issues

We added several new inspections, quick-fixes, and contextual navigation options for common problems you can experience working with databases using an object-relational mapping (ORM) framework like Entity Framework.

  • To help you with a possible “N+1” problem, there are the Possible multiple queries to the database for related entities (N+1 problem) and Possible multiple queries to the database (N+1 problem) inspections, a corresponding quick-fix, and back-and-forth contextual navigation to investigate places in your code where you have a possible “N+1” problem.
  • In addition to detecting “N+1” problems, we introduced one more useful inspection when working with Entity Framework: Query can return incomplete data for related entities. We now also have a quick-fix and a back-and-forth contextual navigation to help you investigate this issue.

Read more about new Entity Framework-related inspections in the blog post.

Inspections for working with local functions

ReSharper 2023.2 introduces two new inspections and corresponding quick-fixes aimed at improving code readability with local functions:

  • A recommendation to put an explicit return or continue before local functions at the end of a method.
  • A suggestion to move local functions to the end of a method or block and separate them from executable code with an explicit return, continue, or another control flow jump statement.

For cases where you don't want to or aren’t allowed to change the code, ReSharper 2023.2 will display an interline hint with return; or continue; statements before local functions to help you understand the code without changing it.

Check out this blog post with more details about the new inspections.

Inspections for #nullable directives and NRT annotations

Inspections for #nullable directives and NRT annotations

Several new inspections for #nullable directives and NRT annotations are now available:

  • A Redundant nullable directive inspection.
  • An Unused nullable directive inspection.
  • An inspection to alert you to cases where nullable reference type (NRT) annotations contradict JetBrains.Annotations attributes on a base member.

To learn more about these inspections, please visit this blog post.

Improved navigation from var declarations

Improved navigation from var declarations

All navigation actions (Go to..., Find Usages, etc.) now suggest underlying types when navigating from var for common types used to wrap other types. For example, ReSharper will suggest navigating to Person when using the Go to declaration action from the var keyword of a variable with the ImmutableArray<Person>? type.

You can learn more in the following blog post.

Primary constructors C# 12 preview

In the 2023.2 version, we introduced primary constructor support for non-record classes and structs from the C# 12 preview. There are several inspections that detect those types where the initialization can be expressed with new primary constructors and suggest applying a quick-fix to greatly reduce the amount of code repetitions.

Sometimes, the initialization of the type must be made less trivial and can no longer be expressed using a primary constructor. For such cases, we introduced a couple of context actions to reverse replacement from primary constructor parameters to constructors and ordinary fields.

To see all of these and much more features for primary constructors in action, check out the separate blog post.

Support for default parameter values in lambdas

Support for default parameter values in lambdas C# 12 preview

As part of our work on supporting C# 12 language updates, we’re introducing support for default parameter values in lambda expressions. In addition to the standard set of warning messages associated with recognizing this syntax, we also tweaked an existing inspection, The parameter has the same default value, to account for default parameter values in lambdas. More information is available here.

Better support for disposable resources

ReSharper 2023.2 introduces two new code inspections designed to better control an object disposal:

  • The Return of a variable captured by ‘using’ statement inspection alerts you when the returned object is immediately disposed of.
  • The Return of a task produced by ‘using’-captured object inspection identifies scenarios where a Task is produced by an object captured by a using statement and then immediately returned.

We also improved the Generate dispose pattern feature to support the IAsyncDisposable interface and be able to generate an async method to release the resources.

You can find more details for these additions here.

Better C# discard support

The code analysis received a bunch of new useful additions to C# discard support:

  • You can now quickly check the names and types of discarded values with the Push-to-Hint functionality.
  • There is a The _ name is typically reserved for local parameters without usages warning about variables and parameters named _ that are actually being used. They look like a "discarded" value, but in reality, they represent very much the opposite.
  • A Use discard assignment inspection is available to replace an unused variable and parameter with a discard.

Check out the blog post to learn more about improved discard support.

Inlay hints

New inlay hints for improved code readability

Inlay hints with tuple component names

When passing a value to a tuple argument or return type, C# allows you to skip component names. However, without the names, it becomes more difficult to tell the meaning of each component without looking at its target type. For example, many software developers will have to check where a tuple (null, false) is assigned to understand what its components mean.

That’s where inlay hints can help you out! ReSharper 2023.2 will display inlay hints with tuple component names when those names aren’t already apparent from the component expression, making your code much easier to read and understand at a glance.

For null and default components, ReSharper 2023.2 will display hints about their target types even if the target component doesn’t have an explicit name. It will make an exception for string and object types, as those usually aren’t very informative.

Another common situation in which names can improve readability is deconstruction patterns where an explicit name is known either from the Deconstruct method or from source tuple components. These hints were developed to provide you with additional context when a pattern itself doesn’t contain enough data to understand what is matched, such as value is ({ }, true, null).

Improved support for #pragma warning directives

Improved support for #pragma warning directives

Pragma directives allow you to disable or restore compiler warnings by their IDs easily. However, while such IDs are a great way to communicate with the compiler, they might be hard for human developers to understand. Without comprehensive knowledge, it may not be clear what an ID like CS0168 or CS0618 refers to or what requires attention.

Adornments for LINQ

Adornments for LINQ

LINQ queries can often be complex, involving multiple transformations and projections. Debugging complex LINQ queries can be time-consuming, especially when dealing with large data sets. To help you easily inspect the output at each step of the query, ReSharper will now display intermediate results as inlay hints during debugging.

With editor adornments showing intermediate results, you should now be able to quickly identify if there are any unexpected values or incorrect transformations happening along the way.

C++ support

Safe Delete

Safe Delete

ReSharper C++ introduces the Safe Delete refactoring to let you remove symbols from the source code safely. This refactoring is available for classes, functions, variables, enumerators, namespaces, and even concepts.

Before deleting a symbol, ReSharper C++ searches for its usages and lets you preview the changes to the source code, so you can be sure that all the removals are intended. For example, if you try to delete a complex entity like a class or a namespace, ReSharper C++ will recursively check the usages for all its members.

More C++20 and C++23 features

More C++20 and C++23 features

This release brings support for several new language features, including if consteval, C++23 standard library modules, [[no_unique_address]] attribute, and static operator()/operator[].

What’s New in ReSharper C++ 2023.2

Code formatting

Adornments for LINQ

Formatting fluent API calls

ReSharper 2023.2 introduces a couple of new options for C# code formatting, designed to improve the readability of chained method calls.

The first code formatting option controls whether a line break comes before the first method call. The second option is for situations where method and property invocations are mixed, and it determines whether a line break should be inserted after the property invocation.

AI Assistant Limited access

AI Assistant is not bundled with ReSharper and must be installed separately. For the time being, there’s a waiting list for access to the AI Assistant feature.

Learn more about AI Assistant and how to install it via the Toolbox App or dotUltimate installer in our webhelp.

Chat with AI Assistant

Chat with AI Assistant

By default, AI Assistant inside ReSharper is aware of your development environment: the programming languages, frameworks, libraries, and technologies used in the solution. This awareness allows the AI to generate more accurate and specific responses to your queries.

The Smart chat option enables AI Assistant to reference specific files and symbols, retrieve code fragments or the latest changes, and look for usages of particular methods. As a result, it can offer even more accurate suggestions.

Context actions

Context actions

With the AI Assistant plugin installed, ReSharper’s context actions will offer a number of AI-powered options. AI Assistant can help you:

  • Explain selected code
  • Identify potential issues
  • Come up with code for unimplemented methods
  • Generate XML documentation

Predictive Debugger Beta Visual Studio 2022

The predictive debugger mode we’re introducing in ReSharper 2023.2 is able to foresee all possible states triggered by executing a program without having to actually execute it, making it able to:

  • Show the expected values of the variables.
  • Visually “mute” parts of the program that will not be executed.
  • Warn you in cases where further execution will end with an exception.

The predictive debugger will offer a new level of insight into your program’s execution. It will also enable you to experiment with different values and troubleshoot your code without having to restart the debugging process for each change.

You can enable the predictive debugger by going to ReSharper | Options | Tools | Debugger | Editor Integration | Predictive debugger | Show predicted values (beta).

Learn more

This debugger is currently in the Beta state, which means your feedback is crucial for it to reach its full potential. Please make sure to report any bugs you encounter to our issue tracker, along with any suggestions or requests you may have.

Decompiler

Assembly diff

ReSharper 2023.2 provides a way to make a detailed comparison between two assemblies. This feature is especially useful when scrutinizing the differences between two versions of a specific assembly and searching for potential vulnerabilities that may have been introduced in a newer version.

To compare assemblies, click Compare Two Assemblies in the Assembly Explorer tool window. Both single-file applications and .exe or .dll files can be selected for comparison.

Click here to learn more about the feature.

Performance

With ReSharper 2023.2, we’ve revised our approach to caching the data required by the IDE to make its systems work. This revision, supported by myriad performance tests, resulted in a noticeable reduction in disk space consumption for each solution you open. In practical terms, it means overall less time spent doing disk input/output and faster loading times for solutions.

Another change that led to improved solution loading speed was the refactoring of ReSharper’s internal component construction logic. Click here to learn more.

Miscellaneous

Dynamic Program Analysis

  • Previously, DPA sometimes mistakenly counted paused debugging time as code execution time, leading to false positive database issues. This issue is fixed in version 2023.2.
  • Previously, DPA could highlight large blocks of code if the corresponding call stack contained memory allocations by lambda functions. Now, highlighting is more granular.
Download

Free 30-day trial available