ReSharper 2025.1最新变化

ReSharper 2025.1 delivers initial support for .NET 10 and C# 14 preview features. This release also brings new inspections targeting common C# pitfalls, along with several quality-of-life enhancements. Performance has been significantly improved with an overhauled string interning system and rebuilt support for Razor tag helpers and Blazor components. Additionally, this release unveils dotMemory integration in Visual Studio and introduces the new Qodana team code quality plugin for enhanced CI/CD pipeline integration.

C# 支持

.NET 10 Preview 和 C# 14 支持

ReSharper 2025.1 delivers initial support for .NET 10 and C# 14 preview features.

未绑定泛型类型的 nameof

Previously, using nameof required specifying all type arguments, causing unnecessary verbosity. C# 14 允许 nameof(List<>) 而不显式列出类型实参。 ReSharper 现在可以检测 nameof 表达式中的冗余泛型类型实参,并提供了快速修复来简化它们。

一类 Span<T> 转换

C# 14 在 ReadOnlySpan<T>Span<T>T[] 之间引入了新隐式转换,使基于 span 的代码更加直观。 ReSharper 现在完全支持这些转换规则,帮助您编写高效、现代的 C# 代码。

简单 lambda 形参的修饰符

在 C# 14 中,您现在可以在 lambda 表达式中使用 refoutinscoped 等形参修饰符,而无需显式形参类型。 ReSharper 提供了快速修复来移除冗余的类型规范。

Learn all about the improvements to C# language support in ReSharper and Rider on our blog.

In addition to introducing support for C#14 features, this release also brings several new inspections targeting common pitfalls and inefficiencies across different C# versions:

New context action to convert interpolation to concatenation

A new context action lets you convert string interpolation back to concatenation. While ReSharper has long supported converting string concatenation ("Id = " + someId) to interpolation ($"Id = {someId}") or string.Format("Id = {0}", someId), this update completes the cycle by allowing the reverse transformation, giving you more flexibility in structuring string expressions.

Redundant duplicated code

ReSharper now detects and highlights even more code duplication patterns appearing in conditional constructs like if and switch, and makes refactoring suggestions for cleaner, more maintainable code.

Possibly Mistaken Use of CancellationToken

ReSharper now detects cases where a method-level CancellationToken is mistakenly used instead of a local token. It offers a quick-fix to replace the incorrect token or merge multiple tokens using CancellationTokenSource.CreateLinkedTokenSource().

Use nameof to reference enum member name

Calling .ToString() on enum members can incur unnecessary runtime overhead. ReSharper now suggests replacing it with nameof(SomeEnum.Member), improving performance and clarity.

Tuple component name suggestions

ReSharper 2025.1 suggests explicit tuple component names instead of generic ItemN names, making your code more readable and self-documenting.

Inexact stream reads inspection

ReSharper now warns you when Stream.Read() and ReadAsync() methods are used without checking their return values, which can lead to incomplete data reads. It suggests replacing them with .ReadExactly() to ensure correctness.

Modification warning in the Debug.Assert inspection

Since Debug.Assert calls are removed in RELEASE builds, ReSharper warns you about assertions that modify state and could lead to unexpected behavior in production code.

C++ 支持

ReSharper 2025.1 为 C++ 支持带来了多项改进:

  • 引入了 Inline Macro(内联宏)重构。
  • 支持多个新的 GNU 语言扩展。
  • 包含大量蓝图资源的 Unreal Engine 项目的内存使用优化。
  • 捆绑了 Clang-Tidy 20,并支持在 ARM 设备上使用 Clang-Tidy。
  • 更新了 GoogleTest 支持。

Learn more about the C++ updates from the What's New in ReSharper C++ 2025.1 page.

代码重构

Toggle <ImplicitUsings> refactoring

Implicit usings automatically include common namespaces, reducing boilerplate. ReSharper now provides an easy way to toggle implicit usings on or off across your project, removing redundant explicit usings when enabled or adding necessary ones when disabled.

Reworked Transform Parameters refactoring

ReSharper has modernized the Transform Parameters refactoring, adding support for value tuples, records, and async scenarios to improve code flexibility and maintainability.

代码格式设置

Chop formatting context action

A new formatting action applies chop formatting to various C# constructs, improving code readability and consistency.

其他改进

  • Comment formatting now ensures proper wrapping and the addition of spaces after //. You can find some helpful screenshots inside these tickets: [RSRP-225809], [RSRP-78312].
  • We've also added an option not to insert a line break before a single lambda expression argument in method invocations. [RSRP-467905]

用户体验

Push-to-Hint activation and indicator improvements

We've refined Push-to-Hint behavior in ReSharper to prevent unintended activations caused by conflicts with other Ctrl-based shortcuts. Additionally, we've introduced a visual indicator to show when the mode is active.

Context highlighters for extended types list

ReSharper now visually highlights members that extend base classes or implement specific interfaces when you place the caret over a type name in the base types clause.

性能

Memory consumption

在此版本中,我们彻底改进了字符串驻留系统。 IDEs process an enormous number of strings, including source code, syntax elements, symbol names, and file paths, so efficient string handling is critical. Our new string interning system stores, on average, four times as many unique strings as its previous iteration and consumes about half as much memory to do so, freeing up resources in large-scale .NET projects.

Blazor 和 Razor 改进

Razor 标记帮助程序和 Blazor 组件支持已在 2025.1 中完全重建。 这项期待已久的重做将使用大量组件的大型 ASP.NET 解决方案的分析时间减少了 5%–10%。 编辑 .cshtml/.razor 文件时,您还会遇到更少的重新分析事件,错误报告也显著减少。

The latest status update on out-of-process ReSharper

We've been testing the latest out-of-process (OOP) implementation of ReSharper internally for the past four weeks, and we're truly excited about the results so far. While we're still working to support all features and fix known issues, the core functionality that makes ReSharper an essential part of your development workflow is coming together nicely.

Read our latest blog post for a complete status update on OOP ReSharper.

Memory profiling dotUltimate

在 Visual Studio 中使用 dotMemory 进行快照分析

dotMemory 现在已完全集成到 Microsoft Visual Studio 中。 以前,您在 Visual Studio 中只能触发性能分析,必须切换到独立的 dotMemory 应用程序才能分析结果。 现在,您可以在 IDE 中完成应用程序的性能分析和内存快照分析。

代码质量

The Qodana Team Code quality extension

Qodana is a team code quality tool that leverages JetBrains inspections to help teams run checks and audits and establish quality gates in their favorite CI/CD pipeline. Now, you can download the Qodana Code quality extension via your ReSharper installer to bring Qodana Cloud or self-hosted Qodana projects into Visual Studio.

Identify code issues, bugs, and vulnerabilities, run the analyses directly in your pipeline, and then view issues in your IDE where you work for better contextual updates and learning. You also have the option to download it as a standalone tool using the ReSharper installer.

游戏开发

适用于 ReSharper 的 Unity 插件

ReSharper 2025.1 附带了一个捆绑的 Unity 插件,支持所有主要的游戏开发工作流。 该插件提供了针对 Unity 事件函数和 API 的代码补全、带有 Unity 文档链接的工具提示摘要,以及检测常见问题的专用检查。 它包括对 ShaderLab 文件的支持,提供语法高亮、代码补全和错误检测。 该插件还会自动处理 .meta 文件,并检测 Unity 场景、预制件和资源中字段和方法的隐式使用。

ReSharper C++ continues to provide dedicated support for Unreal Engine development.

反编译器

ReSharper 2025.1 brings several improvements to the decompiler, enhancing support for the latest C# features and improving code readability. Here’s what’s new:

  • Support for required members.
  • Added support for the new System.Threading.Lock type introduced in C# 13.
  • Support for ref fields and scoped parameter modifiers.
  • Support for the allows ref struct generic anti-constraint.
  • Pattern-based using for ref struct types.
  • Support for string interpolation.
  • Certain integer constants in decompiled code now include commented hexadecimal representations for better readability.
  • Support for file-scoped namespaces.

其他显著改进

New postfix template: .inject

C# 12's primary constructors have simplified dependency injection. The new .inject postfix template further streamlines constructor dependency injection by automatically introducing a parameter in the primary constructor and suggesting a meaningful name.

Structured logging support

ReSharper now provides enhanced structured logging support, helping developers write and analyze logs more efficiently.

Language injection in return values

ReSharper now allows language injection annotations on method return values, extending previous support for parameters, fields, and properties.

Improved multiline To-do comments

Previously, multiline To-do comments required indentation for continuation. ReSharper 2025.1 removes this restriction, making it easier to write and manage multiline to-dos while still enforcing indentation where provided.