What’s new in the latest ReSharper 2017.2 EAP builds?

ReSharper 2017.2 EAPIt’s been four weeks and 7 EAP builds since we blogged about the ReSharper Ultimate 2017.2 EAP (Early Access Program) — time to have a thorough look at what’s new since!

Improved C# 7.1 support in ReSharper

With C# 7.1 around the corner, several new language features will come available. In our first ReSharper 2017.2 EAP, we already added support for the default literal. This newest EAP comes with support for a change in pattern matching with generic types, full support for async main, and supports tuple projection initializers.

Traditionally, when we would want to project a collection and then run LINQ over it, we’d have to resort to using either a helper class or an anonymous type for doing that projection. Not only that: if we just wanted the values for name and age, we’d have to allocate those explicitly as well:

var item = list
    .Select(p => new { p.Name, p.Age })
    .FirstOrDefault(p => p.Age > 21);

var name = item.Name;
var age = item.Age;

It looks verbose, and in fact there are several things happening under the covers that make this less than optimal. The compiler will generate an anonymous type which we are allocating on the managed heap (for every element in our list). We then have to allocate our name and age as well.

Granted, we could make this a bit more efficient by rewriting the example a little bit, or use C# 7.1’s tuple projection initializers. No anonymous type, less allocatons on the managed heap, and pleasant to read:

(var name, var age) = list
    .Select(p => (p.Name, p.Age))
    .FirstOrDefault(tuple => tuple.Age > 21);

Just like with the anononymous type, C# 7.1 infers the value tuple’s element names from the projection here. We’ve also added an inspection for checking redundant value tuple component names:

Inspection for checking redundant value tuple component names

Note if you want to use this, the ValueTuple type is required. It’s built into .NET 4.7, .NET Core 2.0, Mono 5.0 and .NET Standard 2.0. If you’re on another target framework, the System.ValueTuple package will have to be installed.

When using ReSharper’s Go to Everything (Ctrl+T) or one of the other navigation features, we can find types, type members, files, text, … It’s a powerful search engine, much like the ones we use to find things on the Internet! ReSharper’s search supports partial search terms, CamelHumps, misspellings, … In this EAP build, we made finding things in our projects even more powerful!

ReSharper now returns results when word order is incorrect. What was that method called again? Was it ValidUser() or UserValid()? No worries, Go to … will find it:

Navigation - Word order no longer matters to find results

Sometimes we do know the correct name of what we are looking for. However when that name is something more generic like Service, ReSharper may return a lot of search results…

Navigation for general word returns lots of results

Just like with Internet search engines, ReSharper now supports adding quotes to enforce an exact match:

Navigation supports exact matching using quotes

It’s also possible to use wildcard * or ? inside quotes for a more exact wildcard match. For example "*Service" will show UserService, IssueService, WorkItemService – as long as it ends in Service.

ReSharper – Inspections and quick-fixes

We’ve always had a code inspection that encourages using implicit types using the var keyword (or, depending on your code style, the other way around, using explicit types). This EAP now also applies this inspection and its corresponding quick-fix to out variables:

Use var for out variable

A couple of other inspections were added as well:

  • New code inspection that detects possibly unintended transformations from IQueryable to IEnumerable.
  • More context actions and quick-fixes supporting <inheritdoc/>. We now show a warning when <inheritdoc/> is used in an invalid context. There is also a suggestion for adding <inheritdoc/> when implementing or overriding members, as not adding it would hide documentation from the base symbol.

There are many ways of checking for null values and there are many preferences with our users for what style of null checks should be used when generating code. We have added a new options page, Null checking, where the priority of null checking patterns used by quick-fixes, context actions and code generation actions can be configured:

Null checking priorities

ReSharper – Web

A lot of work in the latest ReSharper Ultimate 2017.2 EAP build was done on the TypeScript side:

  • We improved support for mapped type members in Find Usages and in the Rename refactoring (Ctrl+R, R). For example, the name property from our IDog interface will be found in mapped and derived types now:
    Find usages in mapped type
  • For TypeScript 2.3, we added the contextual this for object literals and the --strict option.
  • TypeScript 2.4 enums with string values (or mixed string/number values) are now supported by ReSharper. And when referenced via a mapped type property, string values are correctly found/renamed.
  • TypeScript 2.4 support for generic inference from contextual type returns and generic contextual signatures.

We made several JSON improvements as well, for example when working in package.json. ReSharper knows about the file type and when we invoke Quick Documentation (Ctrl+Shift+F1) on a package name, we can see additional package details as well as links to the home page, tarball and issue tracker:

Quick Documentation in package.json

While we’re in package.json: completion for scoped NPM packages like “@angular/core” now also works:

package.json scoped packages completion

ReSharper – More!

When generating a constructor using the Generate action (Alt+Insert), parameters for that constructor can be made optional:

Make parameters optional

ReSharper Build reduces the time it takes to build our solution by applying heuristics to only build projects that need updating. This latest ReSharper Ultimate 2017.2 EAP build adds .NET Core support to ReSharper Build.


Several other improvements and fixes went into dotPeek. We now have proper decompilation of assemblies that used nameof() in their original source code. We made various improvements and fixes for displaying and navigating in IL code.

SourceLink is a new way of embedding infomation about an assembly’s original source code into the PortablePDB format. Both our standalone decompiler as well as ReSharper now support SourceLink: when an assembly is compiled with the Roslyn compiler flag /sourcelink:<file> (and a source_link.json is generated using, for example, Cameron Taggart’s SourceLink tools), dotPeek will now download sources referenced in the PortablePDB or use the embedded source files when available.

Speaking of PortablePDB – we added some more features to the Metadata tree:

  • Navigation to embedded sources
  • Navigation to source_link.json
  • Display of embedded CustomDebugInformation blobs of the following kinds: AsyncMethodSteppingInformation, TupleElementNames, DynamicLocalVariables, EditAndContinueLocalSlotMap, EditAndContinueLambdaAndClosureMap

PortablePDB metadata with source_link.json

The Go to String (Ctrl+Alt+T) navigation is now integrated into Go to Everything (Ctrl+T). Additionally:

  • It searches for strings in attributes, making it easier to find occurences of a given string in a (decompiled) code base.
  • Improved presentation of long and multiline strings.
  • When searching for a substring in such string, dotPeek now navigates to the substring position instead of jumping to the start of that long or multiline string.

dotTrace and dotMemory

We have been working hard improving the profiler engine powering both dotTrace and dotMemory. First of all, we added support for profiling .NET Standard 2.0 applications, on our own machine or remote.

The profiler core engine now supports setting a directory where temporary files, diagnostics and snapshots are stored. This is especially handy when profiling remote applications: if the profiler has no write access on the system drive, dotTrace and dotMemory can still profile the application.

Several bugfixes went in as well. We fixed a crash of the CLR running the application being profiled when a forced garbage collection happens during garbage collector initialization. A deadlock when the profiler shuts down during forced garbage collection was fixed, too.

ReSharper C++ improvements

A number of changes and new features went into ReSharper C++, including performance improvements – for example on switching build configurations.

Let’s have a look at what else is new.

Code analysis and quick-fixes

An analyzer was added to check when a local variable can be defined as a constant. ReSharper C++ will inform us about that and display a suggestion in the editor.

From the ReSharper settings under Code Editing | C++ | Naming Style, we could already edit the naming styles for generating new entities. We now added an inspection that hints when existing code does not conform to these naming styles. The inspection can be enabled or disabled as well:

Naming Styles in ReSharper C++

An inspection for unused return values shows us when we forgot to return the value. Using a quick-fix, ReSharper C++ can solve things for us:


Other inspections and quick-fixes that were added:

  • A quick-fix to add std::move when cannot bind rvalue reference to lvalue.
  • An inspection that shows unused entities with internal linkage.
  • Quick-fix to add an #ifndef/#define/#endif include guard for the Missing include guard inspection.

Editor formatting

Here’s an overview of enhancement to the editor formatter:

  • Support for line wrapping.
  • The formatter supports Clang-format style configuration files (in addition to EditorConfig).
  • Several code formatting settings were added:
    • Option to insert line breaks after template headers and function return types.
    • Options for indentation of parentheses in function declarations, method calls, if/while/for statements.

Language support

The ReSharper C++ team continuously works on adding additional support for the C and C++ languages. For example:

  • Find usages (Shift+F12) and the Rename refactoring (Ctrl+R, R) are now supported for user-defined literals.
  • Anonymous nested structures are now supported in C code .
  • Virtual methods that can be overridden are shown in completion inside class bodies.
  • The type traits std::is_trivially_constructiblestd::is_trivially_copy_assignable
    and std::is_trivially_move_assignable are now supported.
  • More C++17 support!
    • using for attribute namespaces.
    • Code inspections honor [[nodiscard]] and [[maybe_unused]] attributes.

That about wraps it up. We’re looking forward to any feedback you may have on the latest builds of ReSharper, ReSharper C++, dotCover, dotTrace, dotMemory, dotPeek, as well as various command-line packages included in this EAP.

Download the latest ReSharper Ultimate 2017.2 EAP and give it a try!

image description