TypeScript and JavaScript in ReSharper 9.2

ReSharper 9.1 marked our first attempt at supporting the future-of-the-Web technologies:  ECMAScript 6 and TypeScript 1.5. In ReSharper 9.2 we are enhancing this support while taking a look deeper into the future by extending this support to many features of TypeScript 1.6. To make your development even more fun, now we provide support for regular expressions in JavaScript and TypeScript code. And finally, two small but useful features made their way to our TypeScript support: Import completion and Go to type of symbol.

ECMAScript 6 support improvements

ReSharper 9.2 now supports ECMAScript 6 classes, including features like Find usages, Rename, and Code Completion:

ECMAScript 6 classes support in ReSharper 9.2

To make it easier to get accustomed with new destructuring constructs, ReSharper now suggests converting some code patterns to destructuring.

For example, subsequent indexing may be turned into a destructuring declaration or assignment, as suggested by ReSharper 9.2:

Destruct declaration quick-fix

Subsequent indexing in object literal properties can also be simplified to using a destructuring and short-hand properties. You get hints that look like this:

Destruct shorthand properties quick-fix

TypeScript 1.5 support enhanced

TypeScript 1.5 introduced decorators and ReSharper 9.2 supports them:

TypeScript decorators support in ReSharper 9.2

ECMAScript6-style imports now have Code Completion for available items:

Import statement code completion in ReSharper 9.2

Navigation and Rename refactoring now work for ECMAScript6-style imports and exports too:

Import statement rename in ReSharper 9.2

Initial TypeScript 1.6 support

TypeScript 1.6 aligns even more with ECMAScript 6, and introduces support for generator functions and methods. ReSharper 9.2 supports them:
TypeScript 1.6 generators support in ReSharper 9.2

TypeScript 1.6 also introduces local types – types which can be declared within a lexical scope. This feature is now supported by ReSharper 9.2 as well:

TypeScript 1.6 local types support in ReSharper 9.2

Also, since 1.6, type aliases can be generic. This possibility is also handled by ReSharper 9.2:

Generic type aliases support

TypeScript 1.6 also introduces a new feature called type predicates. You can use a signature invocation as a type guard if the corresponding signature has a special type annotation with the “is” operator. This works structurally, so that in the “true” branch the guard accepts all types that have a subtyping relation to the provided type, and in the “false” branch the guard accepts only types that do not satisfy this criterion. ReSharper now handles this as well:

Type predicates support in ReSharper 9.2

You’ve waited for this a long time, and TypeScript 1.6 now has abstract classes, which are supported by ReSharper 9.2, too:

TypeScript abstract classes support in ReSharper 9.2

One more heavily requested feature has made its way into TypeScript 1.6, and ReSharper 9.2 now supports that, too. I’m talking about async functions and methods and the await operator:

TypeScript async await support

Note that TypeScript 1.6 language is still a work in progress, so new features may be added or something may change unexpectedly. That’s why our support for it in ReSharper 9.2 is still experimental. There are some known limitations:

  • Arbitrary expressions in “extends” clause and class expressions are not supported for TypeScript yet (but they are supported on the ECMAScript 6 side)
  • JSX syntax is currently not supported
  • Intersection types are currently not supported

New features for TypeScript

ReSharper 9.2 provides two new navigation features for TypeScript: Import completion and Go to type of symbol.

Import completion now provides you with a list of all items that are available for import:
Import completion for TypeScript in ReSharper 9.2

With Go to type of symbol, you can navigate from symbols to declarations of their types, when possible:

ReSharper 9.2: go to type of symbol

Regular expressions in JavaScript and TypeScript

ReSharper 9.2 introduces initial support for regular expressions in JavaScript and TypeScript. Now it covers regular expression literals, and provides syntax highlighting and code completion on them:

Support for regular expressions in JavaScript

Regular expression modifiers are completed as well:

Please note that regular expression editor/validation functionality for JavaScript is not available yet. We’ll extend our support for regular expressions in JavaScript in future versions of ReSharper. Stay tuned.

Enhancements to existing features

There is always room for improvement in our existing features as well. ReSharper 9.2 significantly enhances recursive type handling in TypeScript; makes code analysis in JavaScript behave better with new language constructs; provides more formatting rules for new ECMAScript 6 language constructs; and improves the performance of refactorings in TypeScript.

In ReSharper 9.2, we’ve also extended string literal highlighting to template strings, so that now escape sequences are highlighted inside them as well:

string literal highlighting in ReSharper 9.2

Enjoy the new features, and please feel free to provide your feedback. Thanks!

Posted in How-To's, ReSharper Tips&Tricks | Tagged , , , , | 9 Comments

Welcome ReSharper 9.2, ReSharper C++ 1.1 and More Ultimate Updates

This is to let you know that a fresh update of ReSharper Ultimate tools is now available for download!

This update consists of ReSharper 9.2, ReSharper C++ 1.1, dotTrace 6.2, dotCover 3.2, dotMemory 4.4 and dotPeek 1.5. Let’s take a quick look on what’s new in each of them.

ReSharper 9.2

In addition to almost 400 fixes, ReSharper 9.2 release includes:

  • Improved support for Visual Studio 2015 RTM. ReSharper 9.2 refines integration with Visual Studio 2015 RTM, addressing issues discovered in versions 9.1.2 and 9.1.3.
  • Support for Windows 10 Developer Tools. ReSharper 9.2 provides code completion for API checks and supports new Windows 10 specific constructs.
    Code completion in ReSharper Api checks
  • JavaScript and TypeScript support enhancements including full support for TypeScript 1.5 and ECMAScript 6 and support for regular expressions. Regular expression support for JavaScript in ReSharper 9.2
    Going further in supporting new language versions, ReSharper 9.2 is already aware of such TypeScript 1.6 features as local types, abstract classes, type predicates, async functions and methods and the await operator. Moreover, Go to type of symbol navigation option is now available from the Navigate to menu:
    Go to type of symbol in ReSharper 9.2
    Stay tuned for more details on how ReSharper 9.2 enhances JavaScript and TypeScript support.
  • Run configurations. This is a brand new feature that allows you to create, manage, and execute multiple run configurations in a single solution. A run configuration lets you run, profile or debug a project, a static method or any executable file. For static methods, a run configuration can be quickly created right in the editor:
    Run Configuration from a static method
    You can create multiple run configurations depending on your needs and preferences. To run or debug the active configuration, press Ctrl+F5 or F5. By default, the solution will be rebuilt, but you can also execute the active configuration without rebuilding. If you have dotTrace installed and integrated in Visual Studio, you can launch profiling from the same pop-up menu: 

    Profiling run configuration in ReSharper 9.2

  • A reworked Go to Usages navigation pop-up (which is a non-modal version of Find Usages). The Go to Usages pop-up now shows the context of discovered usages, as well as a progress bar, which can be very handy when looking at heavily used symbols.

ReSharper C++ 1.1

ReSharper C++ 1.1 comes with a variety of updates, such as:

  • Google Test support. ReSharper C++ 1.1 introduces a unit test runner for Google Test that lets you invoke tests and test cases contextually from the editor. Similar to the mainline ReSharper, it comes with Unit Test Explorer and Unit Test Sessions tool windows to view, group, filter and run unit tests, as well as to create and manage unit test sessions. You can also add individual tests to sessions right from the text editor, via the Alt+Enter contextual menu.Google test support in ReSharper C++
    Please note that profiling and code coverage options are not applicable to Google Test sessions.
  • Includes Hierarchy view helps visualize dependencies between #include directives.Hierarchy of include directives in ReSharper C++
  • Enhanced C++ core features support includes inline namespaces (С++11), binary literals and digit separators (С++14).
  • New live template macros for specifying expected types, expected variable names and the current namespace in new live templates that you create for your code bases.
  • Two new refactorings: Introduce namespace alias and Introduce field. Introduce namespace alias refactoring is available via Refactor this menu and can be applied to the initial occurrence or to all occurrences by selection:
    Introduce field refactoring allows to create a new field based on a selected expression, initialize it with the expression or from the constructor, and replace occurrences:Introduce Field refactoring in ReSharper C++ 
  • New code inspections to detect not implemented inline functions, redundant inline specifiers on a function definition and functions that can be const, as well as quick-fixes for these inspections. Automatic import now works with macros as well.
  • A set of performance improvements, most notably ensuring that quick-fixes are immediately available on solution load.

Watch this short video for an overview of what is new in ReSharper C++ 1.1:

The other tools in ReSharper Ultimate have received the following improvements:

With dotTrace 6.2 you can:

  • Analyze incoming HTTP requests of your web applications by means of a new filter in Timeline mode. You can get the exact data on how a particular HTTP request is processed.
    Incoming HTTP Requests
  • Create and profile ReSharper’s predefined run configurations with different run parameters for your startup project.
  • Instantly profile any static method in your code. Simply place the cursor on the method, press Alt+Enter, and in the action list select Debug | Profile ([profiling_type]).
  • Browse performance snapshots right in Visual Studio to delete or keep particular data for further analysis.

dotMemory 4.4 allows you to:

  • Automate the process of getting snapshots. Just set a particular condition and snapshots will be collected automatically after condition is met, such as significantly increased memory consumption or exact period of time.
    Get snapshot by condition in dotMemory
  • Enjoy recently released Sunburst diagram even more with improved navigation and performance.

dotMemory Unit framework 2.0 receives a stand-alone runner for continuous integration, and extends the list of supported out-of-the-box unit testing frameworks to XUnit, MBUnit, csUnit, MSTest, and NUnit. The latter two can also be run from Visual Studio with ReSharper.

dotCover 3.2

Adds integration with ReSharper 9.2 and a set of bug fixes. Check the release notes for more details.

Please note: Currently, MSTest coverage in Windows 10 applications developed in Visual Studio 2015 using the latest Windows 10 tools is not supported, this is scheduled for the next update.

Download them all

Here’s the obligatory big red button at the end of the post:

Get ReSharper now

Licensing and upgrade options

In terms of licensing and upgrades, here are the options available:

  • ReSharper 9.2 is a free upgrade for you if you have a valid ReSharper upgrade subscription or a per-major-version license to ReSharper 9. Updates to ReSharper C++, dotMemory, dotTrace and dotCover are free if you have a valid upgrade subscription to the respective product or to ReSharper Ultimate.
  • You may purchase a single license for ReSharper Ultimate, which includes ReSharper, ReSharper C++, dotTrace, dotCover, and dotMemory. Learn more about ReSharper Ultimate.
  • If you need a formal quote or any other assistance, you are welcome to contact JetBrains sales.
Posted in How-To's, News and Events | Tagged , , , , , , | 48 Comments

How to use JetBrains Annotations to improve ReSharper inspections

ReSharper’s analyses and inspections are already very smart, finding code smells, dead code, and potential runtime issues directly from your source code. They build abstract syntax trees, create a semantic model of your code, and construct control flow graphs for tracking values, especially nullness.

But we can make them smarter through the use of annotations.

If we know that a parameter to a called method should never be null, ReSharper can warn you to check for null before calling the method. Conversely, if we know that a method will never return null, ReSharper can warn you that any null checks on the result are redundant, and help you safely remove the redundant code. Annotations can tell us when items in a list can be null, or will never be null, or when a method is an assertion method, and any code after that method call is redundant due to the assert throwing an exception.

ReSharper inspection for null

ReSharper even uses annotations to provide extra functionality. For example, string format argument matching and regular expression syntax highlighting are enabled on methods marked with annotations, as are navigation to MVC controllers and actions:

Navigation features for MVC actions

And the advanced support for  INotifyPropertyChanged in various UI frameworks is also enabled by annotations:

Extra alt+enter menu items for INotifyPropertyChanged

So what are these annotations and how do we use them?

The good news is that the development team has already done the hard work of annotating the whole of the Base Class Library for you, so you don’t need to do anything in order to get this support when working with standard .NET Framework classes and methods.

Furthermore, extensions can also define “external annotations” for pre-compiled assemblies, such as telling ReSharper that xunit.net‘s Assert methods can result in dead code, or to add regular expression highlighting for Assert.Matches.

Regular expression functionality due to method with annotation

Even better, we can use these annotations in our own code, and improve ReSharper’s analyses and inspections when working with our own types and methods. We can even include the annotations when distributing our code, so consumers of our libraries get better support in ReSharper.

Annotations are implemented with .NET attributes, so it’s very easy to add to your own source code. When running an inspection or looking to activate a feature, ReSharper will look at method calls, properties and so on, and look to see if any annotation attributes are applied to the method, parameters or return value, and use that annotation to help improve the accuracy and usefulness of the inspection or feature.

In order to use the annotation attributes, you need to include them in your project. There are several ways of doing this, targeting different usage scenarios.

The JetBrains.Annotations NuGet package

The simplest way to include the annotations is to add a reference to the official JetBrains.Annotations NuGet package. This will add a binary dependency on the JetBrains.Annotations.dll assembly, which includes all of the attributes in the JetBrains.Annotations namespace. Once added as a reference, your source code can simply use the attributes directly.

The most obvious concern here is in adding a binary reference to a third party assembly. Many developers don’t wish to add references if they can avoid it, especially not to a library that is there solely to aid source code analysis, no matter how helpful it is. Why should I deploy JetBrains.Annotations.dll to production?

Of course, the ReSharper team have already thought of this, and make use of a little-known feature of .NET attributes. All of the annotation attributes are marked with the [Conditional("JETBRAINS_ANNOTATIONS")] attribute. This is a special attribute that the compiler understands, and can be applied to all sorts of types, methods, properties, and, surprisingly, attributes. If the string argument to the annotation is not defined as a compiler symbol in your project properties, the target of the [Conditional] attribute isn’t compiled into the resulting assembly. For methods, this means any calls to that method are ignored. When applied to attributes, it means the attribute itself doesn’t get applied to the compiled target method, class, etc.

So by default, using the attributes referenced from the JetBrains.Annotations NuGet package does nothing at compile time – the resulting compiled assembly does not include a reference to JetBrains.Annotations.dll, and the attributes are not applied to any classes, methods, properties, parameters and so on. However, the attributes are still visible in the source code, and ReSharper can make use of them.

Since the annotations are not included in the final compiled assembly, this method is best suited to applications, where no one else is expected to consume the code – there is no-one who would benefit from having the annotations distributed alongside the app.

Alternatively, if your assembly is compiled with the JETBRAINS_ANNOTATIONS symbol defined, the attribute usages are compiled into the resulting assembly, as is the dependency on JetBrains.Annotations.dll – the dll must be distributed with the compiled assembly. While not the most typical scenario, it can be still be useful if creating a framework for internal consumption, where distributing or deploying the JetBrains.Annotation.dll is not an issue.

Including the source

This scenario best targets third-party frameworks. If your code is to be distributed as a NuGet package that is to be consumed by anyone, it’s not appropriate to include a binary dependency on JetBrains.Annotations.dll. It’s entirely possible that not all consumers will be using ReSharper, and the dependency becomes unnecessary, and unwanted. And using the JetBrains.Annotations package without defining the JETBRAINS_ANNOTATIONS symbol means that your consumers don’t get the benefit of the annotations that you’ve defined.

If you are distributing code for external reuse, you can include the source of the attributes directly in your project. ReSharper doesn’t mind where the attributes are defined – in JetBrains.Annotations.dll, in an external XML file, or in your own code. By default, it simply looks for attributes defined in the JetBrains.Annotations namespace. As long as the attributes exist and are applied to the code, ReSharper will use them for improved inspections and features.

To get a copy of the code, simply open the ReSharper Options dialog and navigate to the Code Annotations page. From here you can easily add a reference to the JetBrains.Annotations NuGet package, or you can copy the source of the annotations attributes to the clipboard. Once copied to the clipboard, you can paste into a new file, and the annotations are now available to be used in your own code.

ReSharper annotations options page

There are two options when copying the code: one to make the annotations conditional, and another to generate the attributes as internal (as opposed to public).

Typically, if you wish to distribute an assembly with annotations, you SHOULD NOT make the annotations conditional, and SHOULD mark them as internal.

Options for copying source

By making them conditional, the source is created with the [Conditional("JETBRAINS_ANNOTATIONS"]) attribute, and the annotations will not appear in the compiled assembly unless you define the JETBRAINS_ANNOTATIONS symbol during compilation. There is little benefit in doing this over simply referencing the JetBrains.Annotations NuGet package.

Marking the annotations as internal means that the classes are only visible to the assembly they are defined in. This is the recommended setting. If you make them public, the attributes can be used by any consumer of the assembly – they effectively become part of your published API! If more than one assembly exposes them as  public, any consumer that wishes to use annotations now has a potential for ambiguous reference errors, as there will be more than one JetBrains.Annotations namespace declaring  public attributes with the same names.

The only real reason for using public is to allow sharing a single implementation of the attributes in a solution that is not going to be consumed by third parties. Again, using the JetBrains.Annotations package makes this simpler and easier.


To summarize, if you want to add annotations to your solution or project, this is what you should do:

To use annotations in an application that no-one will reference as code: Include a reference to the JetBrains.Annotations package, and DO NOT define the JETBRAINS_ANNOTATIONS symbol. The JetBrains.Annotations.dll reference is design time only, and does not need need to be deployed with your application.

To use annotations in an assembly that is to be used by third parties: Include the attributes as source. DO define as internal, DO NOT generate as conditional. Both you and third party consumers will benefit from the annotations.

To annotate a pre-compiled assembly: Create an external annotations XML file, and distribute as an extension.


Of course, now you’ve got the annotations referenced, what attributes are there, and how do you use them? ReSharper’s excellent help site provides details on using the annotations, and provides a full reference of all of the attributes that are available.


Finally, if anyone is worried about distributing or reusing the annotations package or source code, you’ll be pleased to know that both the package and the source code are explicitly covered in section 5 of ReSharper’s license agreement, which allows you to redistribute the annotations, either in source or binary form.

Posted in How-To's, ReSharper Tips&Tricks | Tagged , , | 7 Comments

ReSharper 9.2 Release Candidate 2

Please welcome another round of Release Candidate builds including ReSharper 9.2, ReSharper C++ 1.1, dotPeek 1.5, dotCover 3.2, dotTrace 6.2 and dotMemory 4.4.

Compared to the first RC, Release Candidate 2 contains a pack of performance and stability fixes in Visual Studio 2015, improves understanding of Universal Windows Platform application code, removes a few issues with C# 6 support. Here’s the complete list of fixes in ReSharper 9.2 RC2.

We still expect to publish the final release of ReSharper 9.2 and other ReSharper Ultimate tools later this month. Meanwhile, please download and try Release Candidate 2.

Posted in How-To's | Tagged , , | 7 Comments

ReSharper 9.2 Release Candidate

We have today published Release Candidate builds of ReSharper 9.2, ReSharper C++ 1.1, dotPeek 1.5, dotCover 3.2, dotTrace 6.2 and dotMemory 4.4.

The final release of ReSharper 9.2 and the entire ReSharper Ultimate toolset is expected later this month. To help us make sure that there are no critical regressions, please download and try the Release Candidate.

This list of pending bug and performance reports is what currently separates ReSharper 9.2 from the final release. If more of you start using the Release Candidate, we might be able to locate and fix even more issues in time for the release.

As a reminder, ReSharper 9.2 will refine integration with Visual Studio 2015 RTM (including fixing as many performance problems as we can), provide support for Windows 10 Developer Tools, improve support for TypeScript (including 1.5), and introduce a non-modal version of Find Usages. ReSharper C++ 1.1 will add a unit test runner supporting Google Test.

Posted in How-To's | Tagged , , | 18 Comments

ReSharper 9.1.3 to the Rescue

Visual Studio 2015 RTM users, please be informed that ReSharper 9.1.3 is now available for download, along with corresponding updates to all other ReSharper Ultimate tools.

This update fixes the annoying editor issues that were on display in ReSharper 9.1.2 and that included inverted keyboard input, disappearing caret, and focus switching off the text editor, potentially resulting in Visual Studio crashes.

Additionally, this update fixes ReSharper’s XAML code generation features in Visual Studio 2015 RTM.

If you use Visual Studio 2015 RTM, this is a recommended update for you. If you’re on older versions of Visual Studio, namely 2013, 2012 and 2010, you can skip this update.

If you have previously applied one of the suggested workarounds to improve the behavior of ReSharper 9.1.2, we suggest that you now revert the changes so that Visual Studio uses a single UI for displaying both ReSharper’s quick-fixes and Visual Studio’s quick actions.

We would like to once again apologize for the problems caused, or, to put it the 9.1.2 way, for the psmelbor cdesua.

Posted in How-To's | Tagged , , , , | 12 Comments

Critical Issue with ReSharper 9.1.2 in Visual Studio 2015 RTM: Workarounds and Estimates

UPDATE! The behavior described below is supposedly fixed in ReSharper 9.1.3. Apologies to everyone affected, and please install the new version.

Sometimes bad releases happen, and it looks like this week’s ReSharper 9.1.2 was one of them.

What initially looked like a locale-specific problem turned out to be a universal hindrance for Visual Studio 2015 RTM users, with symptoms such as inverted keyboard input (sgnirt instead of string), disappearing caret, focus switching off the text editor, and random crashes.

We should point out that these problems only affect Visual Studio 2015 RTM users. If you are working in Visual Studio 2013, 2012 or 2010, you are not affected by this problem and you can safely continue using ReSharper 9.1.2.

Yesterday and today we have gathered symptoms and communicated with end users in this issue, and as of now, we have already applied a fix and we are testing it internally.

We will deploy an update as soon as possible this week. Meanwhile, if you are using ReSharper 9.1.2 in Visual Studio 2015 RTM and experiencing symptoms described above, here’s what you can do:

  1. Go to ReSharper’s editor appearance options (ReSharper > Options > Environment > Editor > Editor Appearance) and disable Enable action bar for action indicators and show it next to the left margin.
  2. Go to in ReSharper’s code analysis options (ReSharper > Options > Code Inspection > Settings) and disable Do not show Visual Studio bulb (VS action will be merged into ReSharper bulb).
  3. If none of the above helps, disable ReSharper (Tools > Options > ReSharper Ultimate > Suspend Now).
  4. Install ReSharper 9.1.3 as soon as it is published later this week.

We apologize for causing the problem to Visual Studio 2015 RTM users. We’ll be updating our testing infrastructure to help spot similar problems in future.

Posted in News and Events | Tagged , , , | 31 Comments

ReSharper 9.1.2 for Visual Studio 2015 RTM

Update! ReSharper 9.1.2 has proven to be unstable in many Visual Studio 2015 RTM installations. If you’re affected, please apply available workarounds until ReSharper 9.1.3 is available.

Visual Studio 2015 and .NET Framework 4.6 were both released to market yesterday. Kudos to Microsoft for making this finally happen.

We thought we would come up with a quick guide to help you sort out what to expect from ReSharper integration into the final RTM build of Visual Studio 2015. Here’s what you should know:

  • For those of you wondering if you need ReSharper in Visual Studio 2015 at all, look no further than this comparison table that gives an overview of ReSharper’s benefits over bare Visual Studio 2015.
  • ReSharper 9.1.1 does work with Visual Studio 2015 RTM although it does have a few known issues. The major issue with 9.1.1 is that it is blocking Visual Studio’s quick actions: whenever both ReSharper and Visual Studio detect a problem and provide a fix, you don’t have a way to choose Visual Studio’s quick action over ReSharper’s.
  • To solve the 9.1.1 integration problem outlined above, we have prepared and just published ReSharper 9.1.2. It provides two critical fixes:
    • As was the case with ReSharper integration into pre-release builds of Visual Studio 2015, ReSharper 9.1.2 merges its own quick-fixes and other contextually available actions with Visual Studio’s own quick actions into its Alt+Enter menu:
      ReSharper and Visual Studio actions merged into ReSharper's menu
    • ReSharper 9.1.2 maps Visual Studio’s shortcut for displaying quick actions (Ctrl+.) to its own Alt+Enter menu. In other words, you can use either Ctrl+. or Alt+Enter to display ReSharper’s menu that encapsulates ReSharper’s and Visual Studio’s actions. Previous versions of ReSharper suppressed Ctrl+. instead of taking advantage of it.

    If you are using Visual Studio 2015 RTM, please download ReSharper 9.1.2 to enjoy these integration improvements. Corresponding updates to other ReSharper Ultimate tools are also available.

  • As announced before, we expect to release ReSharper 9.2 in August, and it is currently available via Early Access Program. ReSharper 9.2 will focus on properly supporting Windows 10 application development, as well as ASP.NET 5 development based on the most recent ASP.NET 5 milestone available by then. We’ll also be monitoring if there are any major Visual Studio 2015 integration issues discovered by then, and if they are, we’ll fix them.

We hope you’ll find Visual Studio 2015 RTM as good as it gets and enjoy it even more when you download ReSharper 9.1.2.

Posted in How-To's | Tagged , , , , , | 23 Comments

ReSharper Unified NuGet-based Installer. How?

Recently we published a post explaining some user-visible aspects of the ReSharper Ultimate unified installer. This post attracted lots of feedback regarding the underlying technologies that we used to build the installer. That was probably to be expected, as building a modern-looking installer is quite a hard task. You can either choose to use the standard .msi and accept its limitations and old-school UI, or build your own installer. Of course, the latter requires a lot of effort to re-implement all the standard functionality.
MSI or a custom installer?

In ReSharper, we chose the second way — ‘the road less traveled’ — with a view to a better user experience.

Before I get to the nitty-gritty details, let me formulate the task we set out to solve.

We desperately needed a common installer for our .NET lineup. One that would not only allow our customers to install several products (like ReSharper, ReSharper C++ and dotCover) in one click, but also simultaneously register these products in Visual Studio. For this purpose, we needed to physically share registered binaries of the products that a user chooses to install.

At some point we realized that the designed logic of maintaining product compatibility and performing updates goes far beyond .msi capabilities. We decided to go with the custom .exe installer. Initial design also included such features as automatic updates, support for ReSharper extensions, a lightweight web installer, support for pre-release versions, etc.

When we started working on the new installer, we’d already had some experience in working with NuGet for the ReSharper extensions gallery. That’s why we decided to use NuGet as a primary means for distributing product packages. But before distributing packages, you need to build them first! Previously we had built a bunch of DLLs using a dedicated MsBuild script for every product. The unified installer forced us to invert dependencies in our build system and create a new build script that could support composition.

Direct vs inverted dependencies

Unified Build System

MsBuild had many disadvantages that we wanted to overcome in our build system:

  1. Composability.
    Our build script should operate on folders and collect all parts of the product introspecting subfolders. During development, we needed to be able to work with an arbitrary subset of our products (including the ‘all products’ scenario).
  2. Isolation and control.
    A lot of problems were caused by the fact that MsBuild parametrization is exposed in a shared state. The lack of static typing and development tools support for build scripts also made us dislike the technology.
  3. Difficulties in creating custom steps.

We noticed that it was extremely easy for us to compile all our projects, which contained almost no custom build logic. The magic occurs when we already have the binaries and are, therefore, able to execute the code from these binaries. We used some features of our component model to express build steps right in the code of our projects. This script is responsible for building NuGet packages, packing installer standalone tools and many other tasks. To execute the script, we load the compiled assemblies and execute the application model similarly to the one we use in our products. This also implied creating custom annotations and a system of build steps that operate on build artifacts. As all the dependencies are inverted, the core build script contains generic operations which are extended in product-specific projects.

Artifact pipeline

An important part of the build system is its dependency on the folder layout. Special annotations are used to create packages encapsulating DLLs and other content.

Encapsulating DLLs and other content into NuGet packages

Our local and remote build infrastructure still uses .csproj files, but only to keep the ability to edit projects in Visual Studio. We are considering different ways to fully switch to file-system-based projects, and the approach used in the recently introduced .xproj project format looks very promising. Our build tool is capable of switching between source and binary dependencies, so you’re free to choose what project you want to be able to edit and what to keep only as a binary. MsBuild doesn’t have native support for this, so we use a set of hacks to make the switch possible.

Sharing the code of a build script and the production code was a great experience for us. Some results of build tasks could be serialized, saved into NuGet packages and used directly at run-time or in an installation script. For example, the component model (a set of classes marked with specific attributes) can be saved at build time and then used at application start-up. This allowed us to significantly reduce the time of the first start-up. In the build script, we also take advantage of using dependency injection and application model.

Installer. Packages and Introspection

Using our build system, we build packages and collect metadata for each package. These metadata are used by the installer to populate the list of products. More specifically, the data are used to expose Visual Studio registration options, product name, and some other options. The installer introspects either our Azure-hosted NuGet gallery (in case of the web-installer) or the local file-system-based gallery (in case of the full installer).

Installation Script

For the installation script, we employed the same approach used in our composite build system. Actually, the script restarts the machine-specific part of the build script extracted from the packages of a specific product. Machine-specific data are passed as an input parameter. The data include local installation directories, machine registry, specified isolation root-suffix and so on. The build script execution system is designed with respect to error isolation and is highly fault-tolerant. The same applies to the installer UI code. The build script is also designed to have no side effects. All temporary data are stored in memory and only the final step performs a limited number of operations on the file system and registry. These operations are stored for safe roll-back in case a user uninstalls the product.

Installation script

Visual Studio Registration

Visual studio has a lot of new MEF-based interfaces which make it easy to install an extension. Unfortunately, there are still some COM-based entities that require an additional effort to generate manifests or special resources. We use generation to avoid code duplication and get rid of potential errors. One of the most complex things is .cto files containing definitions for actions and menus. In ReSharper, we have our own elaborated action system, which also allows us to declare actions in the source code. Here is an example of how actions are defined in our code:

ReSharper action system code sample

Using our build script infrastructure, we load ReSharper actions of all installed products and issue an assembly that contains the .cto file generated specifically for the installed products.


ReSharper unified installer is a high-tech piece of software. Unfortunately, it is too bound to the ReSharper component model, metadata and application model, meaning we can’t share it without sharing our build system, project organization pattern and application model. Nevertheless, we hope that the underlying ideas like composite solutions, functional-style build system described in the application code, application-driven installation and NuGet-based deployment might see wider use at some point.

Posted in How-To's | Tagged , , | 7 Comments

Early Access to ReSharper 9.2, ReSharper C++ 1.1, dotTrace 6.2

Following our plan to deliver ReSharper Ultimate updates every 3-4 months, we are today opening an Early Access Program for ReSharper 9.2 and other ReSharper Ultimate tools. Specifically, this EAP encompasses ReSharper 9.2, ReSharper C++ 1.1, dotTrace 6.2, dotCover 3.2, dotMemory 4.4 and dotPeek 1.5.

Below is a quick overview of what this update has to offer today.

ReSharper 9.2 EAP

The initial build of ReSharper 9.2 EAP is mostly about bug fixes in TypeScript support, IntelliSense and C# code analysis.

  • TypeScript support has received a respectable bunch of fixes. For example, renaming and moving TypeScript code is now expected to be faster in most cases as search for dynamic references is disabled by default (RSRP-427718, RSRP-432856). In other news, ReSharper now draws the line between user code and included libraries/modules, which should positively impact code analysis, navigation and refactorings in multiple scenarios (RSRP-428775). More bug fixes cover the way how features such as Go to Type Declaration and Generate Missing Members handle TypeScript code. In addition to bug fixing, there’s an ongoing effort to provide final support for TypeScript 1.5, and the initial ReSharper 9.2 EAP build comes with support for TypeScript decorators (RSRP-435162).
  • In terms of code analysis, a set of false positives related to PCL usage with .NET Framework 4.5, with or without Xamarin, has been removed (RSRP-394695, RSRP-427743), in addition to several memory usage and performance optimizations (RSRP-437348, RSRP-436891, RSRP-428652). A number of fixes improve code analysis of string interpolation in C# 6 (RSRP-437019), as well as regular expressions (RSRP-440290, RSRP-439698, RSRP-441299).
  • Code completion is now properly case-sensitive again (RSRP-428005) and works a lot faster on extension methods (RSRP-434561)
  • Another notable set of changes is a usability boost to Go to Usages: a non-modal version of Find Usages. The Go to Usages pop-up now includes context of discovered usages, as well as a progress bar, which is handy when you’re looking at heavily used symbols (RSRP-420796).

See the entire list of fixes included in ReSharper 9.2 EAP build 1.

ReSharper C++ 1.1 EAP

ReSharper C++ 1.1 EAP is definitely more feature-packed than ReSharper 9.2.

First and foremost, it introduces a unit test runner for Google Test. This lets you invoke tests and test cases contextually from the text editor:
Invoke tests or test cases from a ReSharper C++ context menu
Similar to how the mainline ReSharper supports other unit testing frameworks, you have Unit Test Explorer and Unit Test Sessions tool windows to view, group, filter and run unit tests, as well as to create and manage unit test sessions.
ReSharper C++ 1.1 can run unit tests based on Google Test framework

At this point you can’t debug unit tests with ReSharper C++ but expect this to change soon.

In other news, ReSharper C++ 1.1 introduces a new refactoring, Introduce namespace alias, available via its Refactor This menu:

Introduce namespace alias refactoring

As soon as you invoke the refactoring, it suggests defining a scope that you want to introduce a namespace alias for:

Defining a scope to introduce a namespace alias

Rounding up a feature set for ReSharper C++ 1.1 is a new hierarchy view called Includes Hierarchy which, quite naturally, helps you visualize and figure out your #include dependencies:

Includes Hierarchy in ReSharper C++

Finally, ReSharper C++ 1.1 brings a whole set of bug and performance fixes in numerous subsystems, from code inspections to formatting, from quick-fixes to live templates: here’s the entire list of fixes included in ReSharper C++ 1.1 EAP build 1.

dotTrace 6.2 EAP

dotTrace 6.2 EAP introduces a new Incoming HTTP Requests event in Timeline mode that helps you indicate time intervals where your web application processes incoming HTTP requests. This includes the time between receiving a request by the server and sending a response. When the Incoming HTTP Requests event is selected, the Filters window contains two sub-filters: URL to determine how much time does a request to a particular URL take, and Method to check the distribution of time between requests with particular methods. You are encouraged to provide your feedback on this feature right here on the blog or in comments under feature request DTRC-10192.
Incoming HTTP Requests

See the entire list of fixes included in dotTrace 6.2 EAP build 1.

dotMemory, dotCover, dotPeek and SDK

EAP builds of dotMemory, dotCover and dotPeek haven’t received any notable updates so far but we expect this to change as the EAP progresses.

ReSharper SDK will be published later, along with one of the upcoming ReSharper EAP builds.

Download them!

Feel free to download EAP builds and let us know how this update is working for you.

Early Access is a great time for you to provide your feedback, so please feel free to submit any issues with EAP builds to issue trackers for ReSharper, ReSharper C++ and dotTrace.

What’s next?

Stay tuned for more EAP builds in coming weeks. Considering that Microsoft has just set Visual Studio 2015 release date to July 20th, we’ll be looking to wrap up this Early Access Program within a month and come up with ReSharper 9.2 RTM in August, as announced earlier.

Posted in News and Events | Tagged , , , , , , | 11 Comments