What’s new in ReSharper 2020.2

ReSharper 2020.2 brings new inspections and quick-fixes for C#8 and nullable reference types, the much-awaited Code Cleanup on Save, a revamped Unit Test Runner, as well as accessibility improvements. Also, ReSharper C++ brings you to the next level of Unreal Engine development and comes with a lot of improvements for C++/CLI support, navigation, and code analysis.

Download

Free 30-day trial

Code Analysis

Nullability code analysis is now aware of more cases and can trace incorrect nullability through deconstruction and the foreach cycle. It also provides a corresponding quick-fix.

Code analysis now takes into account JetBrains.Annotations attributes (both NotNull and CanBeNull) for the API, even in code where nullable reference types are disabled (#nullable disable).

Context actions for converting foreach to LINQ and LINQ to code are also available on IAsyncEnumerable<T> if you have the System.Linq.Async NuGet package installed for your project.

Now it’s possible to easily generate IEqualityComparer<T> and IComparer<T> implementations with the appropriate quick-fixes.

Code Analysis now takes compiler annotations (such as AllowNull and DisallowNull) into account when verifying the nullability of implemented or overridden members.

There are new inspections and quick-fixes to make variables and return types “not nullable” if they have never held or returned nullable values.

Code analysis is now able to follow the dotnet_diagnostic rules from the .editorconfig file. Specify the severity of inspections in the .editorconfig file, e.g. dotnet_diagnostic.CS1058.severity = hint, and ReSharper will display inspections accordingly.

Support for the default implementations in interfaces feature has been enhanced in this release. The left-hand gutter in the code editor shows that a method is implemented or overridden, and our refactorings and navigation are aware of this C# language feature.

Inlay hints are now available in XAML code. We provide hints for markup property names and DataContext, as well as for margins and paddings, which is handy if you don’t want to memorize their orders.

The Suppress nullable warning with ! quick-fix can be disabled for a solution via the Alt+Enter menu.

Code Cleanup

Now you can configure ReSharper to launch Code Cleanup automatically on saving a file! At last!

Third-party plugins are no longer needed for this functionality. This feature can be enabled on the ReSharper | Options | Code Editing | Code Cleanup options page.

There are new, more granular scopes to run Code Cleanup, such as recently modified files and recently opened files, which can significantly reduce the time it takes to get a result as Code Cleanup doesn’t have to run over the whole solution. For more precise adjustment, you can specify what qualifies as “recently”.

Autosave files after code cleanup is finished. This feature can be enabled on the ReSharper | Options | Code Editing | Code Cleanup options page.

There are a couple of improvements to reduce Code Cleanup execution time:

  • Cleanup does not run analyzers when collecting code to clean up unless the corresponding checkboxes are selected in the Cleanup profile. For instance, if a profile has the “Remove redundancies” option unselected, the analyzers related to searching for redundancies won’t be run.
  • Multiple code fixes are executed at the same time for a file. It no longer starts to re-highlight the file after each fix.

Unit Testing

We’ve redone our unit test runner from scratch for both .NET Framework and .NET Core to have the same runner for both runtimes that run out of the Visual Studio process. It helps us solve a bunch of problems with discovering, running, and debugging unit tests, and gives us full control over unit test hierarchies for .NET Core tests.

The new test runner has built-in support for:

  • MSFakes for NUnit, xUnit, MSTest v2 unit test frameworks.
  • TypeMock Isolator for NUnit, xUnit, and MSTest v2.

The most noticeable thing in the UI is that now ReSharper supports the DisplayName attribute in .NET Core tests for xUnit and NUnit frameworks.

Applying filters to the unit test tree, for example, Passed/Failed/etc. will mean the counters provide two separate numbers – the total number of all tests, and the number of tests that satisfy the filter criteria.

There are two new actions in the Navigate To menu:

  • Show all Unit Test Sessions that include this test.
  • Show the test in the Unit Test Explorer tool window.

We introduced support for NUnit's Assert.Multiple method, which makes it possible to check multiple assertions without the code exiting after the first failure.

Time ranges for grouping by duration can be edited directly in the options.

Accessibility improvements

This release comes with improved support for screen readers like JAWS, NVDA, and Microsoft Narrator. These screen readers now have better access to:

  • List and tree components inside ReSharper tool windows.
  • Elements inside the Options dialog.
  • Elements in the Alt+Enter menu.
  • All the Go To dialogs.
  • The code completion popup.

x:Bind support

We have good news for UWP developers – support for compiled bindings with x:Bind is finally here!

ReSharper resolves x:Bind code correctly and offers several inspections and corresponding quick-fixes. It warns you about missing property setters, BindBack attributes, and when there are overload collisions. In addition, there is a set of Create from Usage quick-fixes to generate a proper field, property, or method inside C# code-behind.

There is code completion and parameter info for propertyPath, BindBack, and UpdateSourceTrigger attributes inside an x:Bind expression.

Change Signature and Safe Delete refactorings are now aware of method usage in XAML code and update them accordingly. Also, Make Static/Const and Encapsulate Field refactorings work directly from XAML code and update XAML usages correctly if you call them from C# code-behind.

Nullability awareness is integrated into the x:Bind code analysis. ReSharper now shows you null-related inspections directly inside the XAML code if there are CanBeNull and NotNull attributes in C# code, for example, “Possible System.NullReferenceException” and “Possible null assignment to non-nullable entity” for arguments in a method used in a propertyPath.

Other ReSharper features like Find Usages and Go to Declaration are also aware of x:Bind bindings.

ReSharper Command Line Tools

In 2020.1, Rider migrated from Mono to .NET Core on macOS and Linux. In this release, ReSharper Command Line Tools run on .NET Core on Windows, Linux, and macOS.

Please note that ReSharper Command Line Tools no longer come with Mono bundled, and the tools for macOS and Linux now require .NET Core 3.1.

Another advantage of using .NET Core as a runtime instead of Mono is that ReSharper Command Line Tools can be installed as a .NET Core global tool. Run the following command to install them:

dotnet tool install -g JetBrains.ReSharper.GlobalTools --version 2020.2.0-*

And run the tool with jb tool_name [options], for example:

jb inspectcode yourSolution.sln -o=<pathToOutputFile>

Type and Project Dependency Diagrams

In this release, the yFiles engine which is used to draw the graph has been updated to the latest version. This new yFiles version, in addition to our optimizations, significantly improves the performance of drawing the resulting graph.

Now it is possible to export the resulting graph to new formats:

  • GraphML file format for further analysis in external tools.
  • XPS file format for printing large diagrams that aren’t possible to export in PNG format.

The diagram tool window finally supports the Visual Studio dark theme.

Navigation updates

Navigating to usages of types from external assemblies in the code is now much easier. ReSharper can navigate straight from Go to Type search results to Find Usages. To try it out, search for a type, highlight it in the list with keyboard or mouseover, and call Find Usages or Go to Usage by using the respective shortcuts.

Starting with v2020.2 release, several ReSharper actions can be called, such as calling quick documentation directly from the Go to Symbol and Go to File Member dialogs, using shortcuts mapped to these actions in your favorite keymap scheme.

New Peek actions

A set of new Peek actions have been added to show the result of some common ReSharper actions in a Peek Definition view.

Call the Peek Implementation action to open a Peek view of the implementation by clicking the mouse wheel while holding Ctrl+Alt, or by pressing Ctrl+Alt+Q with the caret on a symbol.

Call the Peek Base Symbols action to observe all the base symbols inside a Peek view. Just press Shift+Alt+Q on a symbol to execute it.

Call Peek Usages action to see usages inside a Peek view by clicking the mouse wheel on a symbol while holding Ctrl.

Refactorings

In this release, the Conflicts dialog has been redesigned as a separate step in the Refactorings interface. The plain list from before has been replaced with a tree grouped by file.

When calling Introduce parameter or Introduce field refactorings on an expression, ReSharper asks which part of the expression the refactoring should be applied to.

Improved Unreal Engine features

Unreal Engine

ReSharper C++ 2020.2 introduces support for the Unreal Engine project model, bringing smarter auto-import suggestions for include directives and support for different solution configurations. ReSharper C++ also adheres more closely to the Unreal Engine guidelines by adjusting inspection severity and code generation actions.

For easier navigation, Search Everywhere/Go To now treats symbols from engine sources like library symbols. There are also several new inspections that enforce the Unreal Engine guidelines and remind you to refresh the project files in Unreal Editor.

Better C++/CLI support

C++/CLI

Since the ReSharper license now covers both ReSharper and ReSharper C++ products, support for C++/CLI – a bridge between the languages – is getting a lot of updates and improved interoperation between C++/CLI and C#.

ReSharper C++ will find derived symbols in C# code, while Go to Base Symbols and Go to Derived Symbols now work on imported CLR entities.

ReSharper C++ now inspects the way you allocate memory and suggests a quick-fix to replace gcnew with new (and vice versa) when the target type is not valid. Another inspection warns you when you try to use the C++ final specifier on a managed class or interface, with a quick-fix to make it sealed instead. Additionally, you can now use a quick-fix to convert a C-style cast to a safe_cast.

What’s new in ReSharper C++

Assembly Explorer

  • NuGet v3 package feeds are now supported in Open from NuGet, Open from NuGet packages cache, and Open NuGet packages.config.
  • Items with similar names are now collapsed in the Open from NuGet and Open from NuGet packages cache dialogs.
  • NuGet packages are sorted alphabetically.

Other features

Formatting

ReSharper now aligns columns of similar code correctly, even when only part of the aligned group is being formatted, so adding a semicolon or a brace doesn't break the alignment anymore.

.NET Tools & Extensions

dotCover dotUltimate

There are some improvements in the dotCover console runner:

  • The --reportype=SummaryXml parameter lets you create a new Summary report type, which includes data on how many classes, methods, and statements are covered in total.
  • The runner can now generate reports of several types at once: --reporttype=HTML,SummaryXml --output=report.html;summary.xml
  • The runner for Linux (Debian, Ubuntu) is now able to perform analysis on ARM64 systems.

Learn more

dotTrace dotUltimate

Both standalone dotTrace and dotTrace in Rider are able to profile the native part of Mono/Unity applications on Windows. Just start a session with the 'Enable native profiling' option, and you’ll see both native and managed call stacks in performance snapshots. This feature could be beneficial for analyzing performance bottlenecks in Unity games.

There are a couple of improvements in the dotTrace console profiler:

  • The profiler lets you control the profiling session (take snapshots, detach from the profiled process, and so on) by sending commands to stdin or to a file.
  • The profiler for Linux (Debian, Ubuntu) is now able to profile applications on ARM64 systems.

Learn more

dotMemory dotUltimate

Now, you can open pinned objects as a separate object set, and can open objects that are not reachable from GC roots as a separate object set.

Improvements in the dotMemory command-line profiler include:

  • Now, in addition to Windows, the command-line profiler is also available on Linux and macOS.
  • The profiler for Linux (Debian, Ubuntu) is able to profile applications not only on x64 but also on ARM64 systems.

Learn more

dotPeek 

dotPeek continues to improve its support for the most recent versions of C#, and the new release brings:

  • Expression-bodied members.
  • Throw expressions.
  • Default parameters and named arguments.
  • NullablePublicOnly attribute.

Learn more

Download

Free 30-day trial