ReSharper 2021.2 Starts Its Early Access Program!
We’ve just started the Early Access Program for the ReSharper 2021.2 release cycle! Let’s look at what the first EAP build has in store.
In case you missed that, starting with the 2021.2 EAP builds of our .NET productivity tools, including ReSharper, we will require .NET Framework 4.7.2 or newer installed on your machine. Learn more here.
Do you still use temporary variables to swap variable values? There is a more elegant way! ReSharper 2021.2 EAP will help you modernize your code with the new Swap via deconstruction quick-fix!
There are two new useful inspections that come with the corresponding quick-fixes:
- Replace empty array creation with
Type.EmptyTypesin case of new
ReSharper 2021.2 EAP respects the generated_code property from your .editorconfig file, allowing you to specify which files to ignore in its code analysis.
Code Analysis is getting a couple of performance improvements:
- Find similar issues now provides its results faster. This is because ReSharper no longer runs analyses that are irrelevant for the corresponding highlighting/inspection.
- We’ve sped up a code analysis for large and complex
switchexpressions by caching/sharing the data needed for different inspections.
Last but not least in this section, we’ve got good news for our VB.NET developers! ReSharper now supports code generated by source generators in VB.NET.
Nullable reference types
We are improving our support for nullable reference types (NRT) and updating some actions accordingly.
If you use NRT, you may have noticed that an action to use explicit types instead of
var always produces a nullable variable. Although that is correct,
var being nullable is an implementation detail of the compiler, and using a nullable type might be confusing if developers never store nullable values in it.
Starting from this EAP build, ReSharper checks whether the variable needs to be nullable, and it will produce a stricter type when possible.
As you adopt nullable reference types, you might use some nullable warning suppressions that are no longer needed, since the suppressed expression is no longer nullable. ReSharper will help you find such suppressions and remove them.
Finally, sometimes we may be too optimistic about some code and suppress an actual problem, thinking it’ll never happen. When this does eventually happen, it’s very hard to backtrack such suppressions, since
! is a very common symbol in source code. If you want to investigate where nullability contracts are violated with suppressions in your solution, you can now enable a new inspection, A suppressed nullable warning might hide an underlying problem, to find every suppression without having to dig through all other usages of the
! symbol. The inspection can be found in the ReSharper settings. And it will not be triggered by default, since suppressions are a completely valid way to prevent the compiler from nagging you about complex code that it cannot analyze.
- While debugging, calling Go To Declaration (or Ctrl+Click) on interface references will navigate you directly to the implementations.
- The Go To Base/Inheritors list shows hidden overrides, as well.
Code Styling and Formatting
- We’ve changed the default formatting preferences to align with the Visual Studio defaults. Learn more at RSRP-479702.
- Support for Pico brace (indenting) style is here.
- It’s now possible to specify advanced naming rules for
records, extension methods, and
Razor developers working on large views can turn off the CPU-intensive assistance and automatic suggestions if their editor begins to lag. You can find the settings here:
ReSharper | Options | Environment | Editor | Behavior | Razor | Allow CPU-intensive typing assist.
- New modernizing inspections: Structured binding can be used instead of
tie(..)and Type trait can be simplified using a template alias or a variable template.
- Improved generation of function definitions: configurable default function body and automatic insertion of the call to the overridden function.
- Clang-Tidy 12.
- Support for the new compiler switches from Visual Studio v16.10.
For more information, please refer to this blog post.
ReSharper Command Line Tools
The InspectCode tool restores NuGet packages and builds a solution before starting the analysis.
Subscribe to Blog updates
Thanks, we've got you!