ReSharper Ultimate 10.1 EAP Build 1 (Part 1)

Have you felt like it’s been all about Project Rider lately? Guess what, it hasn’t. We’ve been busy updating ReSharper Ultimate tools, and yesterday opened a new Early Access Program: ReSharper Ultimate 10.1 EAP 1 is now available for download.

This initial ReSharper Ultimate 10.1 EAP build accumulates a lot of changes across ReSharper and ReSharper C++; a few notable improvements in dotPeek and dotTrace; while changes in dotMemory and dotCover are so far limited to bug fixing and cosmetics.

Well, in fact, there are so many changes that this post only unveils those of them that relate to C# support in mainline ReSharper. Changes in support for other languages, as well as improvements to ReSharper C++, dotPeek and dotTrace will be described in a separate post later this week.

Anyway, please read on.

ReSharper

New context actions around strings

C# 6.0 as a whole and string interpolation in particular has been supported for a while, and this update adds a bunch of actions that help you switch between different ways of handling strings, such as interpolation, concatenation, and string.Format(), and makes sure all this is just an Alt+Enter away.

For instance, there’s now a context action to rewrite a string interpolation expression as a string.Format() call:
Convert to string.Format() call

Fancy string interpolation over concatenation? Alt+Enter will save you the effort of finding the right keys on your keyboard:
Convert string concatenation to interpolation

Gone way overboard experimenting with C# 6.0 features? No problem, ReSharper will detect whenever there’s nested string interpolation that should can be simplified:
Inline nested string interpolation

In some contexts, you just don’t need to use verbatim characters to differentiate identifiers from keywords. ReSharper can now point you at this kind of redundancy, and help you get rid of it locally or in a wider scope:
Remove redundant verbatim character

Other new actions around strings help:

  • Make a string equality check case-insensitive
  • Insert new arguments into string interpolation expressions
  • Use string interpolation expressions with various logger frameworks

New context actions to check argument values

Another group of context actions serves to generate checks upon method parameters based on their types:

  • For string parameters, ReSharper helps generate checks not only for nullness but for empty and whitespace strings
  • For numeric parameters such as int, double or decimal, ReSharper can write a check that ensures that only non-negative values are passed
  • For enum parameters, ReSharper generates a check that makes sure that an enum value being passed is in fact defined in the appropriate enum declaration, therefore guarding against ill-fated casts
  • Finally, for collection parameters, ReSharper helps set up a check against empty collections

Context actions to check parameter values

WCF-specific context actions, inspections and quick-fixes

Something clicked, and we’ve come up with a few inspections and actions that address some of the most common issues in WCF service development.

For example, whenever you have a WCF service method that is marked as [OperationContract(IsOneWay=true)] but it returns anything other than void or Task, ReSharper will spot this and suggest a fix to prevent a runtime error: you can either change return type to void or make the method two-way:

WCF quick-fix for a one-way operation that returns a non-Task type

If you have a [ServiceContract]-annotated interface that doesn’t have a single [OperationContract] member, then there’s something clearly going wrong: ReSharper will spot this and provide a quick-fix to annotate all members of the interface with [OperationContract].

Likewise, if you have methods marked as [OperationContract] in an interface that doesn’t have a [ServiceContract] annotation, ReSharper will spot this and suggest two options to resolve the issue:

WCF: containing type not marked as ServiceContract

Finally, there are new context actions to help you annotate all members in a [DataContract] type with either [DataMember] or [EnumMember] attributes. The longer your [DataContract] types are, the more you’re likely to appreciate this context action:

Context action to annotate WCF DataContract members with EnumMember

More new context actions and quick-fixes

There’s an assortment of new context actions and quick-fixes that can’t be classified as easily. These include:

  • A pair of context actions, one of which comments out a selection (effectively serving as an Alt+Enter equivalent of dedicated ReSharper shortcuts for commenting code), and the other uncomments whatever comment is under caret
  • A context action to delegate implementation of a non-implemented interface to a new field of the corresponding type
  • A pair of context actions to split or join attribute sections
    Context actions to split or join attributes
  • A context action to create another part of a partial type
  • A context action to add braces around switch case statements

Invert Boolean Member refactoring

When you modify a member that returns a boolean so that it gets an opposite meaning (say, refactor a method called IsNotAvailable() to IsAvailable()), you likely want to invert the value that it returns, and update other members that receive values from it.

This is what the new Invert Boolean Member refactoring can do for you. For example, by invoking it on a method, you can choose to rename the method and either invert values inside the method, and/or invert usages of the method.

Invert Boolean refactoring

The refactoring can be invoked on a method, property, local variable or a parameter.

More ReSharper improvements; changes to ReSharper C++, dotTrace and dotPeek…

…will be described in a follow-up post shortly.

What’s next?

Please download ReSharper Ultimate 10.1 EAP and make sure to put it to good use.

If you are experiencing issues with the EAP, please report them to issue trackers of affected products. Links to issue trackers that you can use to report or track issues are as follows: ReSharper, ReSharper C++, dotTrace, dotCover, dotMemory, dotPeek.

This entry was posted in How-To's and tagged , , , , , . Bookmark the permalink.

16 Responses to ReSharper Ultimate 10.1 EAP Build 1 (Part 1)

  1. Regarding project Rider… Are you also investigating an out-of-process ReSharper for Visual Studio? Sounds like a good chance to improve performance and stability for ReSharper. Also memory pressure thus the number of GC should decrease.

  2. Alex Angas says:

    While you’re working on improvements to String.Format, can you please take a look at RSRP-47639? It’s been a wanted feature since 2007 :-)

    Also, along with the context actions for argument values is it possible to include RSRP-293964?

    Thanks!

    • Mike-EEE says:

      LOL… so you want to build a very powerful IDE extension. :) I feel Team R#’s pain here. So many features, so many bugs… will they ever be fixed?! Software is hard. 😛

  3. Pingback: The Morning Brew - Chris Alcock » The Morning Brew #2025

  4. Pingback: ReSharper Ultimate 10.1 EAP Build 1 veröffentlicht

  5. Giedrius says:

    Argh, https://youtrack.jetbrains.com/issue/RSRP-452651 is still not fixed, hopping that will be fixed till 10.1 RTM.

  6. Pingback: Dew Drop – February 5, 2016 (#2182) | Morning Dew

  7. Urs Meili says:

    while you’re improving string operations, how about “move all strings in selection to RESX file”? I am so fed up to press F6 (Move) on every single string literal. I have waited for this since R# 3.0

  8. Martin says:

    Hi,

    citizenmatt writes on GitHub: https://github.com/xunit/resharper-xunit/issues/38
    that in R# 10.1 a dnx runner are be included. But i can’t find any information about that?

    Will be this feature moved to another Release?

    • Matt Ellis says:

      No, this is still planned for 10.1 – this is just the first EAP, not the final feature set. However, we’re also aware that DNX is still very much of a moving target – it’s not even called DNX any more!

  9. Jarrod says:

    I still can’t even use Resharper 10.0 because it uninstalls itself every single time I add an extension to it. I’m stuck with 9.1.3

  10. Paneer Shekar says:

    To the empty collection check, I think !collection.Any() is a better candidate vs. collection.Count == 0.

  11. Patrick says:

    Will Resharper be fully integrated into the IDE as oppose to a separate addon?

Leave a Reply

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