What′s New in ReSharper

ReSharper 2016.1 improves its set of code style features; adds multiple new context actions and quick-fixes; introduces support for VB.NET 14, JSON and Node.js; runs xUnit tests natively; helps ensure the right escaping in string literals; decompiles .NET code into IL code; learns to optimize NuGet references; gets better in many other ways.

Download
Free 30-day trial
Take a short tour
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

What′s new in ReSharper Ultimate

ReSharper is a part of the ReSharper Ultimate family along with dotTrace, dotCover, dotMemory, dotPeek and ReSharper C++.

With every new ReSharper release its fellow ReSharper Ultimate products receive updates as well. Below are the highlights of their latest changes.

ReSharper C++

The latest ReSharper C++ adds a To-do Explorer tool window, new code inspections and quick-fixes, asynchronous Find Code Issues and a Boost.Test runner. It also gets new code generation options, enhances Rename refactoring and extends language support.

To-do Explorer in ReSharper C++
Learn more

dotTrace

dotTrace integrated in Visual Studio becomes a fully functional Timeline Viewer that allows you to perform detailed analysis of timeline performance snapshots right in Visual Studio: select threads, time ranges, view thread activity and filtered time intervals.

Threads diagram with smart tooltips in Visual Studio
Learn more

dotCover

As xUnit.net support is now an integral part of ReSharper Ultimate, dotCover 2016.1 learns to analyze coverage of xUnit.net-based unit tests. In addition, TeamCity can now understand the output of dotCover console runner and highlight its errors and warnings in the build log.

dotCover improves TeamCity integration
Learn more

dotMemory

Like a web browser stores the history of visited Internet pages, dotMemory now stores your navigation history through dotMemory views. Similar to how you do in a web browser, you can navigate back and forward to previously opened views using navigation buttons.

Browser-like navigation between dotMemory views
Learn more

dotMemory Unit

The most recent release of dotMemory Unit, our .NET memory testing framework, improves performance of key queries (Type.Is, Interface.Is and Namespace.Like); supports open generic types in object selection; learns to select objects by wildcards using the Like and NotLike queries.

API improvements in latest dotMemory Unit
Learn more

dotPeek

The latest dotPeek learns to load assemblies from NuGet packages from any online package source, or load packages listed in a packages.config file in your Visual Studio project.

Open from NuGet in dotPeek
Learn more

ReSharper 10

  • ReSharper Build
  • Revised Stack Trace Explorer
  • Usage-aware Go to Declaration
  • Out-of-the-box postfix templates
  • UWP support improvements
  • Support for Google Protocol Buffers
  • Enhanced JavaScript and TypeScript support
  • NUnit 3.0 support
  • Code style settings

ReSharper 9

  • Support for Visual Studio 2015
  • Type dependency diagram
  • C# 6 support
  • Fix in Scope evolution
  • Windows 10 applications support
  • Find type on NuGet

 

  • Code style settings
  • Run configurations
  • Regular expressions support
  • Enhanced JavaScript and TypeScript support
  • ReSharper Ultimate updates
  • Navigation improvements