.NET Tools Early Access Program News Releases

ReSharper 2023.3 EAP 6: Code Analysis Performance Improvements, Support for C# 12 Interceptors, and Much More. 

The latest installment in the ReSharper 2023.3 Early Access Program has just been released, and it’s packed with updates. 

Before you download it, let’s take a look at the changes.

Code analysis performance improvements

ReSharper 2023.3 can now recognize and facilitate more scenarios where code analysis services can operate incrementally when interrupted by typing. This improvement is particularly beneficial for handling large files. The incremental approach ensures that only the necessary portions of the code are re-inspected when developers are still editing a file while the code analysis is ongoing. This speeds up continuous code analysis and conserves battery life on laptops.

Reworked UX for the Extract local functions refactoring

We’ve revamped the user experience for the Extract local function refactoring. In the past, selecting a location for the new function from the list of available options was challenging, and it wasn’t clear what would be affected by that choice.

With the updated UX, you’ll now see a preview of the new function’s signature directly in the code editor. This makes it easy to understand precisely where it will be inserted and how your choice will impact the introduced function. You can also see which variables will be transformed into parameters rather than closures, and which other functions will be relocated to allow calls at the new location.

Support for C# 12 interceptors

The latest version of C# has introduced an experimental feature called interceptors. This feature leverages the new [InterceptsLocation] attribute, which enables you to intercept and redirect specific method calls within your application to an interceptor instead of the original method. This can be used for optimization, as you’ll be able to fine-tune the interceptor method along with its exact arguments for a particular call site at compile time. 

However, some source generators may override certain calls in your program and replace them with their own code.

ReSharper 2023.3 will alert you to an intercepted call with an inlay hint icon, which can take you to the interceptor with a single Ctrl+Click. It’s also now possible to navigate back from the [InterceptsLocation] attribute to the exact code position it intercepts. The same navigation actions are also available from the Alt+Enter menu.

You might want to exclude certain generators from adding visual noise to the editor. For instance, you may not be interested in the latest ASP.NET Core being able to generate interceptors to optimize your .MapGet calls. To prevent calls intercepted by a particular framework from being displayed, you can add the fully qualified name of the generator responsible for producing interceptor methods to the exclusion list in ReSharper’s settings. Alternatively, you can also do so with Alt+Enter and context menus available directly from the inlay hint indicating the intercepted call. This means you don’t need to type the full name of the generator, or even know it beforehand to configure this behavior.

Reworked integration of ReSharper and Visual Studio Quick Actions

Visual Studio and ReSharper’s quick actions can complement each-other well when used discerningly. With ReSharper 2023.3 you can easily leverage the power of both systems. You can now tweak the settings to either use ReSharper’s quick actions exclusively, display suggestion icons for both, or invoke all quick actions from a single access point – the ReSharper bulb menu. 

We’ve also optimized Visual Studio’s Quick Actions retrieval, improving the performance.

New code formatting engine for Razor

ReSharper 2023.3 introduces a new formatting engine for Razor. It’s compatible with the current ReSharper’s C# formatter, thus supporting C# language constructs introduced in recent years and most of ReSharper’s new formatting options for C#. The new formatter also operates faster and is expected to have fewer issues. However, it does modify the default formatting for some code. Therefore, we have introduced an option to revert to the old formatting engine for Razor. You can find it in ReSharper’s Options under Code Editing | Razor | Code Style.

Improved support for projects that use StyleCop.Analyzers code style inspections

StyleCop.Analyzers configuration files are now detected automatically in the projects where they are enabled, and StyleCop-related defaults are now provided even when no config files are present.

File header templating overhaul

Arbitrary file header variables can now be configured in the file header settings page. Also, there is now support for the StyleCop.Analyzers external file header templating. The Update file header cleanup stage should now correctly use it when the StyleCop.Analyzers are configured for the project that the cleaned up file belongs to.

С++ updates

The EAP 6 build brings updates for HLSL support, code completion inside inactive preprocessor branches, a new inlay hint for forwarding references, and other updates. 

For more information, please check out this dedicated blog post

New inspections for identifying vulnerable API usages

ReSharper 2023.3 brings a new security inspection feature designed to make published vulnerabilities more apparent and easier to understand.

The new inspections identify vulnerable NuGet packages in your project and highlight instances where vulnerable methods from these libraries are used in your code. If a vulnerability is detected, the system highlights the problematic code and offers quick actions to remedy it. These actions include recommending an update to a newer version of the package and offering in-depth information about the detected vulnerabilities.

That’s it for now! For the full list of changes included in this build, please go to our issue tracker

As always, we’d be happy to hear from you. Tell us what you think about the latest changes in the comments section below or on X (formerly Twitter). 

image description