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.
Free 30-day trial available
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.
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:
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:
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:
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.
This release comes with improved support for screen readers like JAWS, NVDA, and Microsoft Narrator. These screen readers now have better access to:
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.
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>
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:
The diagram tool window finally supports the Visual Studio dark theme.
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.
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.
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.
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.
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
.
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.
There are some improvements in the dotCover console runner:
--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.
--reporttype=HTML,SummaryXml
--output=report.html;summary.xml
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:
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:
dotPeek continues to improve its support for the most recent versions of C#, and the new release brings:
Throw
expressions.NullablePublicOnly
attribute.Free 30-day trial available