ReSharper Ultimate 2020.1: Improved Support for C# 8.0 and C++20, Dataflow Analysis of Integer Values, and Much More

Hello everyone,

ReSharper Ultimate 2020.1 is now available! We encourage you to try out the first major update this year. Read about the release highlights in this blog post, or visit our What’s New page to see a comprehensive list of improvements.

ReSharper Ultimate 2020.1 is released

This release has tons of changes to the architecture of ReSharper that bring us closer to our goal of running all the core ReSharper features out of the Visual Studio process. All these modifications took place under the hood, so you won’t notice any changes in the UI or the UX in the ReSharper 2020.1 release build. If you missed the news about our progress toward moving ReSharper out of process, this is a good opportunity to catch up and learn about where we are now.


Download ReSharper Ultimate 2020.1

Now let’s talk about the most exciting updates we have for you in the 2020.1 release.

ReSharper

Dataflow analysis of integer values in C#

Check out this new type of code analysis, which tracks how the values of all int local variables vary. It verifies the correctness of all common operations on such variables to detect useless or possibly erroneous pieces of code.

Dataflow analysis of integer values in C#

Nullable reference types

We’ve refactored a lot under the hood in C# language support to prepare code analysis and other features, such as refactorings and ReSharper Build, to support nullable reference types (NRT). In ReSharper 2020.1, code analysis reports compilation warnings related to nullable reference types and provides quick-fixes for most of them, along with a few other new inspections.

Nullable Reference Types

Other highlights

  • We’ve made a lot of improvements and fixes to XAML support that cover WPF, Xamarin.Forms, UWP, and Avalonia XAMLs.

XAML support in ReSharper 2020.1

  • Several small but useful features to Navigation will benefit you whether you prefer to use the mouse or the keyboard to interact with ReSharper. You can middle-click to Go to Declaration, use a full path in Go To File / Go To Everything to find files, or press Ctrl+Enter in the result list of Go to File to highlight the file in the Solution Explorer window.
  • You can export and import any of your Unit Test Sessions. This allows you to share them with your team, between your computers, or between branches when you change something in the code and want to run/cover the same set of unit tests for both branches.

Unit Test Sessions

  • Localization Manager: you can now leave a comment (or edit an existing one) for any value that comes from resource files right inside the grid. Several performance fixes and UX improvements will help you make the grid faster to load and filter, use right-to-left languages, navigate more precisely to specific rows from the text editor and refactoring dialogs, and more.
  • Code formatting brings new settings for C# Code Styles that cover the trailing comma.

See the full list of fixes completed in the 2020.1 release cycle on YouTrack.

ReSharper C++

ReSharper C++ 2020.1 supports several new C++20 features, including constrained type placeholders, abbreviated function templates, and using enum declarations. New coding assistance features like Rearrange Code and Complete Statement help you write and change your code more efficiently. The Introduce Using Enum and Convert to Scoped Enum refactorings offer an easy way to modernize your enum usage. Other changes include new code inspections with accompanying quick-fixes, improved code completion, and new navigation features. For game developers, ReSharper C++ introduces initial support for HLSL (the High Level Shading Language) and offers better conformance to the Unreal Engine coding standard.

High Level Shading Language Support

dotTrace

  • You can profile .NET Core applications on macOS and Linux using the Tracing profiling mode. To do this, you should use either JetBrains Rider or dotTrace command-line profiler.
  • You can attach the profiler to running .NET Core processes on Linux.
  • You can navigate through the Call Tree using the Next Important Call action. Press Ctrl+Shift+Right and dotTrace will navigate you to a node that is most relevant for further analysis. The feature is available in dotTrace Standalone (both Performance Viewer and Timeline Viewer), in Visual Studio, and JetBrains Rider.

Next Important Call action in Call Tree

dotMemory

  • We’ve implemented some bug fixes and stability improvements.
  • We’ve also reworked the internal data format. This means that dotMemory 2020.1 snapshot format is incompatible with earlier versions. At the same time, this will let us introduce some new features in the future releases.

dotCover

  • Update for the users of JetBrains Rider IDE: you can apply both runtime and coverage results filters.

dotPeek

  • The Intermediate Language (IL) Viewer supports custom attributes for interface implementations and generic parameter constraints. For example, a compiler can apply a NullableAttribute and TupleElementNamesAttribute to these entities.
  • Support for nullable reference types has come to the decompiler. Please note that this only works in declarations, not in the bodies of methods.
  • We’ve added support for decompiling the default members of interfaces and Auto-Implemented Property Field-Targeted attributes.

Decompiling the default members of interfaces

  • We’ve improved support for decompiling tuple component names.

We hope you find this new functionality handy. Share your feedback with us here in the comments, in our issue tracker, or on Twitter.


Download ReSharper Ultimate 2020.1

You can use any of these alternative ways to get ReSharper Ultimate 2020.1:

  • Update right inside ReSharper: ReSharper | Help | Check for updates
  • Use our Toolbox App.

About Alexandra Kolesova

Marketing Communications Manager in .NET tools at JetBrains
This entry was posted in Releases and tagged , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

18 Responses to ReSharper Ultimate 2020.1: Improved Support for C# 8.0 and C++20, Dataflow Analysis of Integer Values, and Much More

  1. Mike-E says:

    Woohoo! Really looking forward to this as it seems a lot of issues I reported or were subscribed to were attended. A big shout out to the entire team there for all their diligent work!

    Although, I do not see Blazor support mentioned here. Is that still a work in progress? I thought it was a 2020.1 goal.

    And yes, obligatory mention of THE issue that keeps those of us that use extensions from immediately trying this build in earnest until all our extensions are on board, too. 😛

    https://youtrack.jetbrains.com/issue/RSRP-459966

    Thank you for any consideration!

    • Hello, Michael! Thanks for reporting and upvoting all those issues. The feedback like this only makes our .NET tools better!

      Indeed, as for the Blazor support, we didn’t mention it in the release notes because we will focus on it for 2020.2.

      I’ll check on what progress can be made with the issue above.

  2. Jeremy Morton says:

    Nullable Reference Type analysis has quite a few issues in this release.

    1. A non-nullable reference variable that is used inside a local method; ReSharper says it’s a possible nullable reference:
    var anyCharacter = new Regex(“.”);
    void MyLocalFunction()
    {
    Console.WriteLine(anyCharacter.GetHashCode());
    }

    2. A Nullable variable that you try to access inside a block that checks that .HasValue() is true; ReSharper says it’s a possible nullable reference.

    In this:
    3. (int, int) foo = (default, default);
    ReSharper says “Nullability of reference types in value of type ‘(default, default)’ doesn’t match target type ‘(int, int)’.”

    4. A struct with a nullable reference property:
    private struct StructWithNullableReferenceProperty
    {
    public string? Name { get; set; }
    }
    If you try to do this, ReSharper is happy:
    StructWithNullableReferenceProperty? t = null;
    if (t != null && t.Value.Name != null)
    {
    Console.WriteLine(t.Value.Name.StartsWith(‘A’));
    }
    If you try to do this, ReSharper says that t.Value.Name is a “Dereference of a possibly null reference.” (ReSharper suggests changing the above into this, BTW):
    StructWithNullableReferenceProperty? t = null;
    if (t?.Name != null)
    {
    Console.WriteLine(t.Value.Name.StartsWith(‘A’));
    }

    5. The second call, but not the first, to GetTuple() has the ReSharper error: “Converting null literal or possible null value to non-nullable type.”
    var (v1, _) = GetTuple();
    (v1, _) = GetTuple();
    (Vector3? first, float? second) GetTuple()
    {
    return (Vector3.One, 0.1f);
    }

    6. var seems to throw off the nullability analysis, the second line complains “Converting null literal or possible null value to non-nullable type.”; it’s fine when i is declared as int? instead of var:
    var i = (int?)0;
    i = (int?)null;

    7. Returning “default” as a non-constrained generic Type complains “Possible null reference return.”
    ///
    public T this[int index]
    {
    get => default;
    set => throw new NotImplementedException();
    }

    8. The C# compiler has a hardcoded check for Debug.Assert to consider a variable as non-null after, but ReSharper doesn’t:
    string? s = (string?)”a”;
    Debug.Assert(s != null, “s != null”);
    Console.WriteLine(s.GetHashCode(StringComparison.InvariantCulture));

    • Hi Jeremy,

      Thanks for the feedback! We’re currently checking all issues provided and will let you know where you can track the progress for solving those problems soon.

    • Alexander Kurakin says:

      Hey Jeremy! Thanks a lot for your report. We’ve fixed issues from 1 to 6, and we hope fixes will be available in the upcoming bugfixes. As for 7th and 8th issues, we were not able to reproduce them using the code snippets provided.

      About the 7th one: according to the sharplab.io, this code produces CS8653 or CS8603 warning depending on the Visual Studio version. So, haven’t you disabled any of these warnings using #pragma warnings disable or in the project’s settings?

      About the 8th one: As we know, Roslyn does not have anything special for Debug.Assert apart from the [DoesNotReturnIf(false)] annotation for the conditional parameter and it exists only for .NET Core, not for .NET Framework.
      So, we tried your code sample on both .NET Core and .NET Framework projects and got the same behavior for both ReSharper and Roslyn – both produce the same warning in the .NET Framework project and both do not provide any warning in the .NET Core project. So, any additional info on how to see the issue will be much appreciated.

      • Jeremy Morton says:

        Thanks for the quick turnaround! I’ll work on getting a more complete repro for the last 2 issues.

      • Jeremy Morton says:

        Here’s a repro for the 7th issue, it seems the ternary operator on the return makes the compiler not complain (maybe it should?):

        #nullable enable

        class C
        {
        public T GetDefaultT()
        {
        var items = new T[1];
        return true ? default : items[0];
        }

        public T GetT()
        {
        var items = new T[1];
        return false ? default : items[0];
        }
        }

        • Jeremy Morton says:

          Here’s a more complete example showing what looks like compiler inconsistency when a ternary operation adjusts the return value, compared to not having one.

          • Alexander Kurakin says:

            Hey Jeremy! Thanks for the repro code and sorry for the delay in the reply. So, the missing warning is just a bug in the compiler, and it has already been fixed in the “master (10 Mar 2020)” branch of Roslyn. If you change the value in the Branch combobox from “Default” to “master (10 Mar 2020)” on the sharplab.io, you will get the warning “Possible NRR” on the ternary operator. The compiler from this branch will be available in Visual Studio 16.6 which now in the preview. Since ReSharper is not able to support all compiler versions, we try to support the latest and greatest available compiler (even if it is in the review now, but soon will be available in Visual Studio release build).

      • Jeremy Morton says:

        A repro for the 8th issue:

  3. Jeff says:

    I can tell the performance is improved a LOT! THANK YOU !

  4. Oleksii says:

    R# 2020 appeared to be unusable for me. VS 2017 hangs each 5 min with very simple solution. Rolled back to 2019.

Leave a Reply

Your email address will not be published. Required fields are marked *