What′s New in ReSharper

ReSharper 2016.3 Release Candidate adds initial support for Visual Studio 2017 RC, C# 7 and VB.NET 15; allows to run and debug .NET Core unit tests. Changes also include new quick-fixes, code generation and context actions, updates in navigation and search, further evolution of TypeScript, JavaScript and JSON support, as well as more ways to inject languages.

Download 2016.3 RC
Free 30-day trial

ReSharper 2016.3 Release Candidate

Visual Studio 2017 RC support

Visual Studio 2017 RC initial support

All ReSharper Ultimate 2016.3 products can now be installed into Visual Studio 2017 RC. Note that incremental solution load and new .NET Core unit testing in Visual Studio 2017 RC are not yet supported, and both of these issues will be addressed in further updates.

At the same time, ReSharper Ultimate 2016.3 continues to support Visual Studio 2010, 2012, 2013, and 2015.

Dispose pattern

New code generation actions for C# and VB.NET

The Generate menu (Alt+Ins in a class) is extended with 3 new actions:

  • Relational members helps you automatically overload relational operators (>, <, , ) and/or implement IComparable and IComparable<T> using selected fields and properties.
  • Relational comparer creates a comparer class derived from Comparer<T> using selected fields and properties.
  • Dispose pattern helps you generate the canonical implementation of IDisposable with optional nullability checks and destructor for unmanaged members.

Аctions that help you implement IDisposable and IComparable<T> are also available with Alt+Enter on highlighted code.

The action that generates constructors gets a small update with an option to check parameters for null. If checked, it will generate guard code that throws ArgumentNullException in the constructor.

C# 7 digit separators

Early support for C# 7 and VB.NET 15

ReSharper 2016.3 now understands VB.NET and C# 7 binary literals and digit separators. It adds support for C# 7 local functions and enables a lot of code inspections in their context, such as Possible System.NullReferenceException, Access to disposed closure, and Access to modified closure. C# 7 out variables, pattern-matching in is expressions and switch cases are also supported.

Introduce from all unused parameters

New quick-fixes and context actions

ReSharper 2016.3 adds a new quick-fix to introduce fields and auto properties from all unused parameters. This is an extension to the existing quick-fix that used to work for only one parameter, but now can be can be applied to all unused parameters at once. The Introduce property quick-fix also includes a Configure default menu item, which will set what kind of property is generated by default.

There's also a new context action on fields of type Lazy<T> to introduce a property to encapsulate fieldname.Value.

Transform Parameters refactoring

Transform Parameters refactoring

Transform Parameters refactoring combines and replaces two other refactorings: Transform Out Parameters and Extract Class from Parameters.

It rewrites a method's parameters, changing incoming parameters to a new class, or a tuple, and optionally creating a new class for return value and any out parameters.

As usual, the Transform Parameters refactoring can be invoked from the Refactor This (Ctrl+Shift+R) menu.

.NET Core unit testing

Unit testing in .NET Core applications

ReSharper's unit testing features are finally available for xUnit and NUnit-based unit tests in .NET Core and ASP.NET Core 1.0.x projects in Visual Studio 2015. This lets you run, debug and manage tests in a way you're used to with your .NET Framework projects.

However, if you're targeting .NET Core 1.1 in Visual Studio 2017 RC, you'll have to wait for the next ReSharper update to run and debug unit tests in this environment.

Async Go to Usages

Navigation and search: usage search goes async

ReSharper's usage search engine is updated to make finding references of heavily used symbols easier.

In particular, as soon as you invoke Go to Usages of Symbol (Shift+Alt+F12), the Show in Find Results button becomes available in the pop up. If the search for usages is going to take some time, you can just click this button or press + on the numeric keypad and continue working with the code while the search runs in the Find Results window.

The Find Results window now works asynchronously too, meaning that you can work with the results tree while usages search is still in progress.

Go to Text supports more file types

Other updates in navigation and search

  • New formats of content files (.less, .hbs, .coffee, .scss, .dart, .as, .styl) are supported in Go to Text.
  • Recent Files and Recent Edits pop-ups now show the path to the file. In Recent Files, you can delete entries using the Delete key. Recent Edits can also show all edits in the same method as a single entry.
  • A setting to remember the last search in Go to Everything, Go to Text and other search actions (this behavior is turned off by default for now).
  • Structural search & replace: in C#, string and integer numeric literals can now be matched by value. Literals representing the same integers but written with different suffixes, in different radixes, with or without digit separators are now considered similar.
Build Results tool window

ReSharper Build improvements

ReSharper Build receives several updates in this release. First, the results of a build are now displayed in a separate Build Results window, which lists build warnings and errors. Toolbar buttons and grouping options give you a lot of control over how you want to see the results.

ReSharper Build now uses its own implementation of NuGet Restore. Previously, we would use Visual Studio's NuGet integration to perform restore, but this only worked in Visual Studio 2015. Now, the restore mechanism works in all Visual Studio versions (provided that you have .NET Framework 4.5 or higher installed).

Build options were reworked as well. For example, you can now choose when the Build Results window is shown, such as only when there are errors. Another interesting new option is to log the build to either the Output window, or a file.

Surround with type guard quick-fix

Improved TypeScript, JavaScript, JSON support

  • Support of TypeScript 2.0.2 ("2.0 RC"): boolean, number and enum literal types.
  • Go to Implementation now works for TypeScript types too: you can jump from a base type or member to any of its end implementations, bypassing intermediate steps in the inheritance chain.
  • The Surround with type guard quick-fix lets you quickly add type guards to disambiguate unresolved symbols in TypeScript.
  • You can use Tab and Shift+Tab keys to enable structural navigation in your TypeScript, JavaScript or JSON code
  • The Encapsulate Field refactoring, which helps you quickly create a property for a field and optionally replace usages of the field, now works in TypeScript.
  • Optimized memory usage for TypeScript caches.
  • Code completion for TypeScript literal types as well as a number of formatting fixes for JSX/TSX files.
  • Dynamic completion of package names in project configuration files (project.json, package.json and bower.json)
Language injection options

Improved language injections

In addition to regular expressions and HTML, ReSharper 2016.3 lets you inject CSS, JavaScript and JSON in C#, JavaScript, and TypeScript strings. To mark a string literal as containing specific language, use the Mark as context action or a special comment directive: //language=javascript|html|regexp|jsregexp|json|css

You can also add prefix= and postfix= in the comment to make ReSharper resolve the string syntax as if prefix and postfix were already a part of the expression inside the string.

Finally, ReSharper automatically injects languages in certain known scenarios, such as injecting JavaScript into AngularJS templates, or CSS in jQuery's $[]indexer.

There is also a new options page for language injections, allowing you to selectively enable or disable built-in automatic injections.

Download 2016.3 RC
Free 30-day trial

ReSharper 2016.2

Support for ASP.NET Core 1.0 RTM and tag helper syntax

ASP.NET Core 1.0 RTM

ReSharper 2016.2 adds initial support of ASP.NET Core 1.0 RTM. ReSharper should now correctly resolve project references in projects of this type and provide its core set of features, including refactorings, code inspections and navigation.

Tag helper syntax is now also supported in terms of code completion, navigation, search and refactorings.

However, running .NET Core unit tests is not supported so far: this is going to be addressed in the next update.

Structural navigation with Tab

Structural navigation with Tab

ReSharper now allows using Tab and Shift+Tab keys to jump between logical pieces of your code, similar to how you navigate in your web browser.

For example, when editing a for statement, Tab will select the initializer statement, then the terminating condition and then the iterator statement. Shift+Tab will make these selections in reverse order.

When the cursor sits before the first non-whitespace character in a line, you can still use Tab for indentation.

Learn more: how ReSharper makes Tab great again

Go to Text for textual search

Go to Text for textual search

A new navigation action, Go to Text (Ctrl+T,T,T), lets you quickly find and navigate to any text in source and textual files that are included in your solution. Similar to other navigation commands, if there are too many matching items, you can hit + on the numeric keypad to explore results in the Find Results window.

Advanced ReSharper users may recall an older plugin called Go to Word, and the new navigation action re-implements the functionality of this highly popular plugin right inside the mainline ReSharper.

Warnings in solution-wide analysis

Warnings in solution-wide analysis

If you're using solution-wide analysis, you know that normally, its red status bar indicator turns green as soon as the last error in solution is fixed.

Starting from 2016.2, you can make the indicator stay orange as long as your solution contains any unresolved warnings: both actual compiler warnings and ReSharper's inspections with the Warning severity level.

It is still up to you whether to enable the solution-wide analysis and whether to make it show warnings: you can right-click the status bar indicator to configure everything.

C# typing assistance

More C# typing assistants

ReSharper 2016.2 introduces a set of new C# typing assistance features that correct subtle mistypes as you enter code.

For example, if you happen to type MethodName(.), this will be automatically replaced with MethodName()., allowing you to keep entering a call chain without having to deal with an invalid syntax error.

Similarly, ReSharper will correct a mistyped @$ prefix to $@ in verbatim string interpolations.

Check all parameters for null

New quick-fixes and context actions

A ReSharper update without a new set of code inspections, quick-fixes and context actions is next to unthinkable, and ReSharper 2016.2 is no exception.

New Alt+Enter commands help simplify string interpolation inserts, revert the order of iteration in simple for loops, and fix awaiting of a void method by making it return a Task. Along the way, existing quick-fixes that make methods async were also revised to suggest using Task instead of void.

In other news, you can now check all parameters of a method for null (or empty strings) with a single context action. More than that, uncommenting and deleting comments can now also be done with Alt+Enter actions.

Support for XML doc inheritance

XML documentation inheritance

ReSharper 2016.2 improves support for the <inheritdoc/> tag in XML documentation comments, which is a good alternative to copying documentation from base types/members to derivatives:

  • There is now a context action to add an <inheritdoc/> to an inherited type member.
  • ReSharper can generate missing members and overriding members along with <inheritdoc/> comments if you want it to.
  • Quick Documentation can now correctly work on members that not only inherit documentation from their base members but refine it with additional or overriding comments.
Mark a reference as used at runtime

Safer Optimize References refactoring

Based on popular demand, ReSharper 2016.2 adds a way to mark references as used at runtime. This is important if you're using dependency injection frameworks.

By marking all references that are implicitly loaded, you can safely run ReSharper's Optimize References and Remove Unused References commands without breaking references that are required at runtime.

Refactor to partial type

Move members between type parts

A new refactoring, Extract Members to Partial, helps you quickly move type members between different type parts if partial classes are in use in your solution. Based on your input, the refactoring will use existing or create new type parts.

You can even invoke the refactoring over a #region to move all region members into a new file with a name inferred from the region name.

Revised surround templates

Revised surround templates

If you need to surround a piece of code with a template, you can now just select the code, and type in the name of a template you need: no extra shortcuts required.

In other news, a single template can now be used for for creating code (as a live template) and for surrounding existing code (as a surround template).

Injecting HTML or RegEx via comments

HTML and RegEx injection

You can now take advantage of HTML code analysis inside string literals in .cs, .js, and .ts files. Just put a comment /*language=html*/ ahead of a string literal that contains HTML, or use the Mark HTML here context action to enjoy syntax highlighting, error detection and other kinds of ReSharper's HTML support right inside the string literal.

Regular expression assistance in string literals can now also be enabled when you put a comment /*language=regexp|jsregexp*/ before a string literal that contains a C# or JavaScript type regular expression.

JSON value helpers

JSON value helpers and schema catalogs

JSON value helpers allow you to tell ReSharper to provide code completion or validation for your own JSON files. You can add a helper in the JSON Value Helpers options page, matching based on a filename mask and/or schema match. Custom JSON schema catalogs can also be added in JSON options.

Support for CSS custom properties

CSS custom properties

ReSharper's code inspections, quick-fixes, code completion, navigation, search and refactorings are now made available in CSS custom properties (also known as variables).

For example, in terms of code analysis, ReSharper helps you remove unused custom properties, detect undeclared custom properties and replace their usages with fallback values.

In addition, ReSharper 2016.2 introduces a set of fixes for improved CSS spec handling.

TypeScript 2.0.0 support

TypeScript 2.0 support

ReSharper 2016.2 completes support of language features available in TypeScript 2.0.0, such as abstract properties, this for functions, control flow-aware type guards, path mappings, optional class members, and the never type.

Code generation options in TypeScript code completion

More JavaScript and TypeScript improvements

Other improvements in terms of JavaScript and TypeScript support include:

  • Generating TypeScript code, such as overrides and lambdas, with code completion.
  • Completion for package versions in bower.json manifest files.
  • Improved Find Usages and Rename for union and intersection types.
  • A new quick-fix to implement missing members as abstract.
  • Go to Declaration and Find Usages work correctly with type aliases.
  • When renaming JavaScript function parameters, ReSharper learns to update the corresponding JsDoc items.
Assembly dependency diagram

Assembly dependency diagram

ReSharper 2016.2 adds the assembly dependency diagram to the family of its dependency analysis tools.

You can invoke the diagram on selected assemblies in the Assembly Explorer and explore connections that are established between the assemblies by virtue of their references.

Process Explorer in ReSharper

Process Explorer

The Process Explorer window, which was previously only available in dotPeek, displays all currently running processes, allows exploring their modules and decompiling those of them that are .NET assemblies.

You can choose to show or hide native processes and modules, or turn on process hierarchy view.

Filter the list to find a module or process that you're looking for, and then add its assemblies to Assembly Explorer for further investigation.

Improved IL code viewer

More ReSharper updates

In other news, ReSharper 2016.2:

  • Makes string interpolation suggestions, quick-fixes and context actions available in VB.NET.
  • Extends the C# formatter with new options for indenting of parentheses and code inside them; controlling spaces before and after ++ and -- operators, as well as before and inside parenthesis of checked and default expressions.
  • Helps rearrange code in interpolated string inserts and in expressions with 3 and more operands. "Greedy brace" now works for the opening brace, braces of types and namespace declarations.
  • Makes IL code displayed in the IL Viewer more readable: types, members, type parameters, and local variables are now highlighted with distinct colors; and loops are better distinguishable with indents and comments.
Inline Variable refactoring in C++

ReSharper C++ updates Ultimate

ReSharper C++ 2016.2 adds the Quick Documentation pop-up to display documentation based on Doxygen comment blocks without having to navigate to a symbol's definition.

The new version also introduces the Inline Variable refactoring, and improves automatic completion so that it suggests symbols that are not included in the current file.

There are also certain performance improvements as ReSharper C++'s code analysis engine has been redesigned. For example, this is expected to make ReSharper C++ analyze several times faster when you open the Unreal Engine project for the first time.

Learn more about ReSharper C++ 2016.2.

Download
Free 30-day trial

ReSharper 2016.1

Reformat, apply code style or clean up a selection

Code style features

ReSharper 2016.1 incorporates a diverse set of changes that have to do with how you manage and apply your code style preferences. These changes include:

  • New code style settings, code inspections and quick-fixes to set a preferred style for using named arguments, braces around single nested statements, and grouping of attribute sections.
  • The growing set of configurable code styles can now be applied with a single command: ReSharper | Edit | Apply Code Style. This command (which is currently limited to C#) will enforce your preferences for explicit types vs using var, CLR type names vs type keywords, and other styles configurable under ReSharper | Options | Code Editing | C# | Code Style.
  • An explicit action for reformatting code: to enable a quick, routine reformat without necessarily invoking the powerful Code Cleanup, we provided a new action, which is now available from the main menu (ReSharper | Edit | Reformat Code) or with a keyboard shortcut.
  • Reformat Code, Apply Code Style and Cleanup Code commands are now all available as context actions when you make a code selection in the editor and press Alt+Enter.
A new ReSharper action to convert string concatenation to interpolation

Actions to manipulate strings

ReSharper 2016.1 adds a bunch of Alt+Enter actions that help you switch between different ways of handling strings, such as interpolation, concatenation, and string.Format(). For example, these actions help you:

  • Refactor a string interpolation expression to a string.Format() call.
  • Convert string concatenation to string interpolation.
  • Simplify nested string interpolation.
  • Remove redundant verbatim identifiers, locally or in a wider scope.
  • Make a string equality check case-insensitive.
  • Insert new arguments into string interpolation expressions.
  • Use string interpolation expressions with various logger frameworks.
Context actions to check argument values

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.
  • For collection parameters, ReSharper helps set up a check against empty collections.
Converting a JSON string to a Newtonsoft JSON.NET object

Actions to convert strings to objects

ReSharper 2016.1 introduces two similar context actions that help convert your code to take advantage of the LINQ to XML and JSON.NET APIs.

One of these actions, which is available wherever you have valid XML inside a string literal, lets you convert this string to a LINQ to XML object (using XElement, XAttribute etc.)

The second action in the duo helps convert a JSON string to a Newtonsoft JSON.NET object. The action is only available if your project references Newtonsoft.Json assembly (which you can install from the NuGet Gallery).

Combined with Smart Paste that is also introduced in ReSharper 2016.1, these two actions complete the workflow of transferring existing XML or JSON into C# code.

Context actions to split or join attributes

More context actions

There's an assortment of new Alt+Enter actions (both context actions and quick-fixes) that help you perform a variety of transformations, such as:

  • Comment out a code selection.
  • Uncomment a comment under caret. (Both this and the previous action are effectively Alt+Enter equivalents of dedicated ReSharper shortcuts for commenting code.)
  • Delegate implementation of a non-implemented interface to a new field of the corresponding type.
  • Split or join attribute sections.
  • Create another part of a partial type.
  • Add braces around switch case statements.
WCF-specific code inspections and quick-fixes in ReSharper

WCF-specific actions

ReSharper 2016.1 adds a set of code inspections, quick-fixes and context actions that address some of the most common issues in WCF service development.

  • ReSharper will help you detect and fix WCF service methods that are marked as [OperationContract(IsOneWay=true)] but return anything other than void or Task.
  • If you have a [ServiceContract] interface without any [OperationContract] members, ReSharper will 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.
  • There are new context actions to help you annotate all members in a [DataContract] type with either [DataMember] or [EnumMember] attributes, which is especially useful in lengthy [DataContract] types.
Invert Boolean Member refactoring

Invert Boolean Member

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.

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

Smart Paste ensures the correct escaping in string literals

Smart Paste

ReSharper can now help you ensure the right escaping in string literals that you copy/paste around your code. The feature works in C#, VB.NET, JavaScript, XML, XAML and HTML files, making sure to respect the different ways of escaping illegal characters that are used in different contexts.

For example, you can copy a piece of text or XML that contains double quotes, paste it into a string literal in C#, and have ReSharper automatically escape all the quotes.

This also works when you're pasting a piece of C# code into an XML doc tag: Smart Paste will escape any generics and lambda syntax, as well as logical operators and anything else that is fine in C# but not allowed in XML values.

Other things that ReSharper can escape for you include file paths and line breaks.

NuGet support in Optimize References and Remove Unused References

Optimize Nuget References

Optimize References learns to handle NuGet references that are now displayed in the same tool window as all the regular references that a project contains. ReSharper also adds a new grouping to show possibly unused references that have dependencies in the project, and thus cannot be considered redundant. ReSharper tells you exactly what particular dependencies from a package are actually used in your project.

In addition, the Remove Unused References refactoring now supports NuGet references as well.

Intermediate Language viewer in ReSharper

IL Viewer

The Intermediate Language Viewer, which first appeared in dotPeek, is now available in Visual Studio. You can use the viewer both for drilling down third-party library code, and to display IL that corresponds to your own source code (note you'd have to compile first).

To check out how IL Viewer works, choose ReSharper | Windows | IL Viewer on the menu.

ReSharper's test runner supports xUnit out of the box

Out-of-the-box xUnit

The xUnit.net test framework has seen a large rise in popularity recently, including being the framework of choice for Microsoft's cross platform, open source .NET Core project, and is the officially supported way of running tests for DNX projects.

While ReSharper has had support for xUnit.net for many years, it has always required installing a separate extension. Starting with version 2016.1, ReSharper provides support for xUnit.net directly in the product. This means ReSharper will discover your tests, and allow you to run and debug them, right from the editor, without requiring any extra extensions.

Furthermore, ReSharper Ultimate customers will also be able to profile tests, get code coverage and use xUnit.net in Continuous Testing sessions.

ReSharper starts to understand VB.NET 14

VB.NET 14

Having supported C# 6 quite a while ago, we are now getting up to date with the development of Visual Basic .NET.

ReSharper 2016.1 completes VB.NET 14 support by starting to understand language features such as string interpolation, multi-line strings, null-conditional operators, partial modules and interfaces, and year-first date literals.

JSON support in ReSharper 2016.1

JSON support

ReSharper 2016.1 is expanding its technology reach by supporting JSON files and schemas in all supported versions of Visual Studio (2010-2015).

JSON and JSON schema support currently ranges from things as basic as syntax highlighting in older Visual Studio versions, to more sophisticated features like formatting and rearranging (for example, you can move object properties or arbitrary selections around), code inspections and quick-fixes, as well as code completion that is aware of schemas, paths, regular expressions and packages.

To help you get a quick idea of any JSON file, we have enabled ReSharper's File Structure window to work with files of this type.

Initial support for Node.js in ReSharper

Initial support for Node.js

ReSharper 2016.1 introduces initial support for Node.js.

All ReSharper goodies you are well familiar with, like completion, code inspections, quick-fixes, and navigation features are now available for Node.js.

Improved JSDoc support

JSDoc improvements

JSDoc support is further improved in ReSharper 2016.1. ReSharper can now parse generics, HTML markup, and parameters with properties in your JSDoc comments. Everything that ReSharper infers from JSDoc becomes immediately available in code completion suggestions, parameter information tooltip, etc.

Improved JavaScript and TypeScript formatting settings

More on JavaScript and TypeScript

ReSharper's support of JavaScript and TypeScript keeps evolving, both in terms of width and depth. The following improvements highlight this release:

  • JavaScript and TypeScript formatter settings became much more granular. You can now specify the right margin for your code and define whether and how various code constructs should be wrapped.
  • Rename refactoring can now rename files corresponding to TypeScript types, and Find Usages is aware of TypeScript implementations and overrides.
  • ReSharper now correctly handles TypeScript modules installed via npm, which is crucial in AngularJS development.
  • Full support for TypeScript 1.7 and 1.8, including type parameter constraints, stateless JSX components, augmenting global/module scope, string literal types, and this-based type guards.
  • Initial support for experimental ECMAScript syntax, such as comprehensions, decorators, class properties, exponentiation operator, rest and spread properties for object literals.
  • Experimental support for parts of TypeScript 2.0: readonly properties, implicit indexers, private and protected constructors, abstract properties, and nullable types.
  • Better support of TypeScript and JavaScript in older releases of Visual Studio: for example, ReSharper can now highlight JSX, as well as ECMAScript 6 and 7 in Visual Studio 2013.

Improved error highlighting

ReSharper 2016.1 comes with improved highlighting ranges for errors involving complex types. Previous versions of ReSharper would highlight the entire statement containing an error, which would hinder locating where the error was coming from, especially with complex generic types.

From now on, ReSharper highlights only the part of type that is erroneous (however, watch out for Visual Studio 2015's own error highlighting) and offers more ways to fix mismatching types.

Async Find Code Issues

Previously, when you used ReSharper's Find Code Issues command in any given scope, you had to stop and wait until the code analysis was over.

Starting with ReSharper 2016.1, Find Code Issues works in the background, in a manner similar to Find Usages. This lets you keep editing or navigating your code while ReSharper runs its analysis and populates the Inspection Results tool window in the background.

Download
Free 30-day trial