What if this method were faster? Forecasting performance with dotTrace

When profiling and analyzing performance of an application, we sometimes ask ourselves questions like, “What if this method were faster?”, “What would be the performance gain if we made this specific call 50% more efficient?”, and “Is it worth doing?”

One way to tell that would be to optimize that method and profile the application again – a time-consuming task that could involve changing the program structure without knowing if it makes sense to do so. The other option would be to ask dotTrace to reduce the method’s execution time and then recalculate function timings “as if” that method were optimized. Continue reading

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

ReSharper Ultimate build for Visual Studio 2017 RC

Microsoft has just announced its latest IDE preview release, and we’re here to sim-ship a compatible version of ReSharper Ultimate.

Just get ReSharper Ultimate 2016.3 EAP 9 and install it into Visual Studio 2017 RC. You should be able to install all tools that are included in ReSharper Ultimate, namely ReSharper, ReSharper C++, dotCover, dotTrace and dotMemory.

Granted, both the new Visual Studio and the ReSharper EAP are pre-release products, so issues are to be expected here and there.

Please try installing the EAP build in Visual Studio 2017 RC and let us know how it works for you.

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

ReSharper Ultimate 2016.3 EAP 8

ReSharper Ultimate 2016.3 EAP 8 is here. In this build, we fixed another bunch of issues and added a few new features.


External stack traces open automatically

Stack Trace Explorer now lets you open external stack traces even faster – if you copy a stack trace that contains symbols from the currently opened solution and then switch focus to Visual Studio, ReSharper will automatically load it to the Stack Trace Explorer without the need of pressing any shortcuts. This behavior is configurable on the Tools | Stack Trace Explorer options page.

Decompiling directly from nuget.org

Assembly Explorer (ReSharper | Windows | Assembly Explorer) adds a new way of loading assemblies – directly from nuget.org or from any NuGet package source:

Opening assemblies from NuGet package source

By the way, this feature has been also available in recent versions of dotPeek.

Further development of TypeScript features

  • The Encapsulate Field refactoring, which helps you quickly create a property for a field and optionally replace usages of the filed, now works in TypeScript.
  • Optimized memory usage for TypeScript caches.

Formatter improvements

  • Indenting of nested for, foreach, while, lock statements is now disabled by default, with options to restore the old behavior.
  • New option for indenting type parameter constraints.
  • Fixes for bugs introduced in 2016.2 by the new indenting engine.

ReSharper C++

This EAP build brings support for nested namespace definitions introduced in C++17.

C#-style XML documentation comments are sometimes used for C++ symbols. Now they are correctly displayed in the Quick Documentation pop-up (Ctrl+Shift+F1) and in the quick info tooltip:
XML documentation in C++ pop-ups

Download ReSharper Ultimate 2016.3 EAP

Please feel free to download the latest ReSharper Ultimate 2016.3 EAP build.

If you come across any problems with this build, please let us know in issue trackers of ReSharper and ReSharper C++.

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

ReSharper Ultimate 2016.3 EAP 7

Another build of ReSharper Ultimate 2016.3 EAP is out. Build number 7 fixes dozens of issues and brings a set of new and improved features.


New code generation actions for C# and VB.NET

The Generate menu (Alt+Insert in a class) gets 3 new actions:

  • Relational members helps you automatically overload relational opeartors (>, <, , ) and/or implement IComparable and IComparable<T> using selected fields and properties. Optionally, you can choose from several string comparison algorithms and generate nullability checks.
  • Relational comparer creates a comparer class derived from Comparer<T> using selected fields and properties. In addition to choosing a string comparison algorithm and generating nullability checks, you can opt for generating a static property that will expose the comparer class to consumers.
  • Dispose pattern helps you generate the canonical implementation of IDisposable with optional nullability checks and destructor for unmanaged members.

All the new generation actions work both in C# and VB.NET. Even better, actions that help you implement IDisposable and IComparable<T> are also available with Alt+Enter on highlighted code:
A quik-fix that helps implement a dispose pattern for IDisposable

Usage search goes async

The updated usage search mechanism makes finding references of heavily used symbols easier in two ways:

  • The Show in Find Results button becomes available in the pop up as soon as you invoke Usages of Symbol (Shift+Alt+F12). So if you see that the the search for usages is going to take some time, you can just click this button or press + on the numeric keypad and go on working with the code while the search continues in the Find Results window.
    Opening Find Results from 'Go to Usage'
  • The Find Results window now works asynchronously too, meaning that you can work with the resuls tree while usages search is still in progress.

Improved support of C# 7.0 and VB.NET 14

  • Deeper analysis of C# local functions enables a lot of code inspections in their context, such as 'possible null reference exception', 'access to disposed closure', and 'access to modified closure'.
  • ReSharper now respects the new #Disable Warning/#Enable Warning directives in VB.NET.

Support of UWP RelativePanel control

ReSharper now correctly resolves element name references, detecs binding errors, and provides code completion for the RelativePanel control in Windows 10 Universal apps.

Code completion in RelativePanel control

ReSharper C++

  • The postfix completion that we announced in EAP 6 now also works after ->.
  • New options for C++ formatter: 'Spaces wihin parentheses in cast expressions' and 'Place enumerators on new line'.


In addition to multiple performance improvements, dotTrace also delivers a number of new features in this build.

Call Stack improvements

Call Stack Before 2016.3
Call Stack After
The Call Stack tool window in dotTrace Timeline gets a whole bunch of enhancements in 2016.3. This window consists of two sections: Top Methods for displaying methods with the highest execution time and Call Tree for digging into the call tree. Each of the sections gets improved in this release:

  • We returned the Show system functions option that was helpful when analyzing methods’ own execution time. If you select this option, system calls are shown separately in the Top Methods list and user methods don't include their time. Otherwise, user method’s own time includes the own time of child system calls.
  • The Top Methods list now shows not only methods’ own time but total time as well (total time includes the execution time of the entire call subtree).
  • Moreover, now you can click on a method’s own or total time in Top Methods or Call Tree. This will apply a filter by a corresponding method (if you clicked on the own time link) or by a method and its subtree (if you clicked on the total time link).
  • The Top Methods list now follows your selection in Call Tree. When you select a particular method in Call Tree, Top Methods is rebuild to show you only child calls of the selected method.
    Call Stack. Follow selection

Download ReSharper Ultimate 2016.3 EAP

As ever, we welcome you to download the latest ReSharper Ultimate 2016.3 EAP build.

If you spot any problems with this build, please do report them to issue trackers of affected products: ReSharper, ReSharper C++, dotTrace.

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

ReSharper Ultimate 2016.3 EAP 6

ReSharper Ultimate 2016.3 EAP 6 is now available to download. Let’s take a look at what’s in this latest build.


EAP 4 introduced support for profiling .NET Core applications, and now you can profile .NET Core unit tests directly from ReSharper’s test runner. You’ll note that currently, dotTrace hasn’t yet added folding or subsystem definitions for the xUnit.net or .NET Core modules, which can make it a little harder to read, but don’t worry, we’re working on this.

dotTrace showing test results

As before, there are certain restrictions – this is Windows only, right now, and targets the CoreCLR, not Mono. It also only supports Sampling mode. However, we previously suggested setting the  COMPLUS_ReadyToRun environment variable. This is no longer necessary – dotTrace will do this for you.

Next up, the Timeline view in dotTrace now supports capturing native allocations. This is enabled in the Advanced view when Timeline is selected.

dotTrace native allocation option

Once enabled, dotTrace will capture events whenever there is a native allocation. Note that this has an overhead, and can have a noticeable impact on the application being profiled.

After profiling is complete, and the data is analysed, dotTrace will add a new filter of “Native Memory Allocations”. When selected, this will filter down to only the events which caused native memory allocations, selecting the time slices on the main Timeline view, and filtering the Call Stack top methods to the methods that were making the allocations.

dotTrace native allocation results

We’ve also added a new Events tool window that aggregates file, HTTP, SQL or exception events that have taken place during the currently selected set of time slices. This is similar to the filters of the same name, but is designed to allow examination of the events, rather than to use them as the filter. Selecting an event will give details of the event, including timestamp, duration and call stack.

dotTrace Events tool window


This build sees initial support for C# 7.0’s pattern matching in  is expressions and  switch cases. This is just the start, and more support is of course coming in future builds.

The JavaScript language injections that we introduced in the last build get a little more polished, as we fix Rename and Find Usages, and syntax highlighting should work more reliably, too.

Our tool for speeding up your solution build timeReSharper Build, is also getting a bit of an update in this EAP.

Firstly, the results of a build are now displayed in their own Build Results window, which will list build warnings and errors. Toolbar buttons allow hiding warnings, displaying a preview of the code with the error, and exporting the results to a file.

You get a lot of control over how you want to see the results, too. You can show them as a flat list, or enable grouping, to show by a mixture of project, folder and file. Or you can use ReSharper’s semantic knowledge of the file to group by namespace, type and member.

Build results tool window

The options are currently being reworked, as well. For example, you can choose when the Build Results window is shown – always, never, only when there are errors, or when there are warnings or errors. We’ve also split the heuristics lists into their own page, and added a NuGet restore log page, to capture output from NuGet restore activities.

The other interesting new option is to log the build to either the Output window, or a file. You get to choose what kinds of messages are output – errors, warnings, messages and standard console output – and of course, the location of the log file.

ReSharper Build options

And ReSharper Build now gets its own implementation of NuGet restore. Previously, we would use Visual Studio’s NuGet integration to perform the restore, but this only worked in Visual Studio 2015. We’ve rewritten this so it now works for all Visual Studio versions. The new NuGet options page allows capturing and viewing log information for restores.

ReSharper C++

The “Third Party Code” options page is proving popular! Introduced for JavaScript and TypeScript in EAP 4, updated to include CSS in EAP 5, and EAP 6 now adds C++ support. Just to recap – this page allows adding files, folders and wildcards to be treated either as “skipped” or “library”. ReSharper will completely ignore “skipped” files, and treat “library” files as read-only – indexed for navigation, but no inspections or quick fixes.

And finally, ReSharper C++ gets a form of postfix completion that is very much like C# extension methods. If you “dot” an expression, ReSharper C++ will now suggest free functions that would accept that expression as the first parameter. When you accept the suggestion, ReSharper C++ will rewrite your code so that the expression is passed as the first argument.

C++ postfix completion

Please download the EAP and give it a go! As ever, if you encounter any issues, please let us know.

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

Navigate to text in a solution with Go to Text in ReSharper

Navigating within a solution is easy with ReSharper. Hitting Ctrl+T lets us navigate to types, symbols and files in our solution. In ReSharper Ultimate 2016.2 we added another navigation, Go to Text, which makes navigation to text in source and textual files much easier than using Visual Studio’s Find in Files. And much faster, too!

Now why add another navigation when we already have things like Find Usages, Go to Everything, Go to Implementation and so on? Not everything is code. Very often a solution may contain pure string references, like error messages emitted to the user. Comments may have issue numbers from a bug tracker in them. We may want to find a specific string value throughout our code base. Or search where a regular expression is used. Using Go to Text we can navigate to those very easily, whether the results are in source files, configuration, JSON or elsewhere.

Press Ctrl+T 3 times or use the ReSharper | Navigate | Go to Text menu to bring up the navigation pop-up. After typing (part of) the text to search, we can use the arrow keys to navigate through the list of results.

Using Go to Text to find a connection string throughout codebase

The nice thing is Go to Text searches in both source files and other known file types. In the above example, that makes it really easy to search where a specific setting is being used, whether in code, configuration files or elsewhere.

Just as with other navigation types in ReSharper, we can select an item from the list of results and press Enter (or click the item) to navigate there directly. We can also use the Show in Find results (+ on the numeric keypad) to display the list of results in a separate window.

Go to Text show results in separate window

Go to Text will remember the last 10 searches we navigated to. This makes it easy to repeat searches without having to type them again.

Repeat searches in Go to Text

A nice touch is auto-paste from selection and from clipboard. We can select text in the editor and then press Ctrl+T 3 times to immediately start searching for that selection.

Select text and invoke Go to Text to search for selection

By default, Go to Text searches in all source files and in any .bat, .ps1, .md, .txt, .sql, .rb, .php, .py, .java, .jsp, .kt, .ini or .fx file. Want to exclude files and folders? In ReSharper’s options, find the Environment | Search & Navigation page and add them under Elements to skip.

The Go to Text navigation is bundled with ReSharper Ultimate 2016.2. For earlier versions, head over to the extension manager and install the Go to Word extension with similar functionality.

Do give it a try and let us hear your feedback through the comments below!

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

ReSharper Ultimate 2016.3 EAP 5

We have recently published yet another build of ReSharper 2016.3 EAP, and let’s now look what’s inside.


In mainline ReSharper, there is a number of fixed issues and some new features:

Dynamic completion of package names

In project configuration files (project.json, package.json, and bower.json), ReSharper can now suggest available package names based on your input:

Dynamic completion of package names

Language injections

In the first build of 2016.3 EAP, we added support for CSS and JSON as embedded languages, and now we’re adding support for JavaScript. This means that ReSharper will be able to parse the contents of a string literal, and treat it like a JavaScript snippet – with syntax highlighting, code completion, inspections, quick-fixes and so on.

As before, this can be enabled using a specially formatted comment –  //language=javascript – which means the marker and the injected language will be shared across the team. If you don’t wish to modify the file, you can also use Alt+Enter and the “Mark as” submenu, which stores a tracking marker in ReSharper’s caches, but mind that the marker is local to your machine only:

Marking string literal as JavaScript

ReSharper also automatically injects languages in certain known scenarios, such as injecting JavaScript into AngularJS templates, or CSS in jQuery’s  $[] indexer. For C# code, it will also automatically inject based on usage of the  HtmlElementAttributes and  HtmlAttributeValue annotation attributes.

This build also includes a new options page for language injections, allowing you to selectively enable or disable built-in automatic injections:

Automatic Language Injection options page

ReSharper C++

Among other fixes in ReSharper C++, this EAP build fixes the problem of user output from tests in Boost 1.62 and improves performance of the Boost.Test runner.


dotMemory now checks your application on finalized objects and objects queued for finalization. A new Finalizable objects inspection on the overview page shows such objects sorted by their type.

dotMemory Finalizable Objects Inspection

There are two problems in having finalized objects:

  • The finalization thread is run unpredictably, which, first, may cause problems in case you want to reclaim the unmanaged resources as quickly as possible, and, second, may lead to sudden performance drops.
  • The lifetime of finalizable objects is extended by at least one more garbage collection cycle (when garbage collector reaches such objects, it first promotes them to the next generation).

Therefore, it is more effective to implement the IDisposable interface for these objects. In this case, you reduce objects’ lifetime and explicitly run all disposal routines via the Dispose() method.


dotPeek introduces new ways to explore metadata of .NET assemblies – in addition to displaying and searching for metadata tokens, you can now dig through all metadata items (tables, blobs, strings, etc.) in the Metadata node that appears under each assembly. Noticeable features of this node include:

  • Automatically finding and displaying usages of metadata table items.
  • Decoding and displaying values of blob items.
  • On double-click, decompiling and displaying code that corresponds to the metadata item.
  • Exploring PE file headers.

Metadata tree in dotPeek


If you haven’t done so yet, please download the latest 2016.3 EAP build and give it a try. As usual, we welcome your feedback via issue trackers of the corresponding products: ReSharper, ReSharper C++, dotMemory, and dotPeek.

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

UI designer tooling usage survey

Every now and then we’re setting up surveys in order to know better about different details of a software developer’s routine. This is even more important when our own experience is insufficient or not representative of what we feel might be going on in the industry as a whole.

This time, we have set up a quick survey to get a better understanding of how .NET developers use UI designer tools in their development environments.

For us, looking into the results of this survey will help figure out how to (or whether to) plan implementing UI designer tools in JetBrains Rider, the emerging .NET IDE.

For you, taking part will (1) help get your UI designer workflow considered, and (2) set you up for a chance to win a prize of your choice: a JetBrains souvenir, an Amazon Gift Voucher or a GlobalGiving Gift Card.

Take the UI designer usage survey! This shouldn’t really take more than 5 minutes of your time.

Thanks a lot!

Posted in How-To's | Tagged | 8 Comments

ReSharper Ultimate 2016.3 EAP 4

Another week, another ReSharper Ultimate 2016.3 EAP build! EAP 4 is out now, and brings a number of new features.

dotTrace and .NET Core

EAP 4 adds initial support for profiling CoreCLR based .NET Core applications to dotTrace. Initial support means that there are a number of rough edges, not only because the CoreCLR itself has some issues with supporting profiling. Notably:

  • Windows only. This feature is aimed at the CoreCLR, and as such doesn’t add profiling for Mono based .NET Core apps. We currently have no plans to support profiling on Mono. Also, because dotTrace is a WPF application, it only runs on Windows.
  • Sampling and tracing modes only. The CoreCLR is missing functionality required by dotTrace’s Timeline mode.
  • Attach to process is not supported by the CoreCLR. All profiling sessions must begin by starting the process.
  • Requires the  COMPLUS_ReadyToRun=0 environment variable to be set. This is to work around issues with the implementation of profiling in the CoreCLR. Future EAP builds will remove the need for this step.

To get started, first set the COMPLUS_ReadyToRun environment variable, as mentioned above, and then start dotTrace. Then:

  • Select “Standalone” as the application type.
  • Add  C:\Program Files\dotnet\dotnet.exe as the application.
  • Check “Advanced”.
  • Set the “Arguments” field to  run, and point the “Working directory” field to your project folder (where  project.json lives).
  • Check “Profile child processes”.
  • Select “Sampling” or “Tracing”.
  • Check or uncheck “Start immediately” to either start profiling immediately, or control with the popup window.
  • Click Run.

Profiling settings for .NET Core

The application is then profiled, as normal. Once the application finished, or you collect a snapshot via the control panel, the snapshot is available in the Snapshots section of dotTrace. You can click Open and view the results, with all of the expected dotTrace functionality, listing method names, decompiling source, what-if analysis and so on.

dotTrace profiling a .NET Core console application

PLEASE NOTE: .NET Core applications execute your user code in a child process of the initial dotnet run process. By default, dotTrace will automatically open the snapshot results of this initial process, which doesn’t contain any of your user code! To view the results for your code, you have to navigate to the Snapshots section of the dotTrace main home screen and open the child process results manually. (Alternatively, instead of profiling dotnet run, you can profile dotnet my.dll, with the working directory set to the output directory for the assembly. dotTrace will automatically open the correct snapshot.)

dotTrace Snapshots screen

This build has been focused on getting the engine working with the CoreCLR. We’re very much interested in your feedback on the user experience. Please comment on these issues: DTRC-23694 and DTRC-23696.


Inspection severity options redesigned

We always sweat the small stuff at JetBrains, and we have a couple of features for ReSharper that are small, but we think are important. For example, the inspections severity options page has been redesigned, mainly because we were running out of space for new languages with the old design!

Inspection Severity dialog

Revised Recent Edits and Recent Files

We’ve also tweaked how the Recent Files and Recent Edits popups work and show their results. Specifically, Recent Files can now delete entries with the Delete key, and both the Recent Files and Recent Edits popups will now also show the path of the file, to avoid confusion with similarly named files. Finally, the Recent Edits popup will also merge edits in the same method.

Recent Files popup

Recent Edits

Join Lines

And we’ve added one more very small but very useful editing feature – Join Lines. It simply joins two lines. That’s all! It’s a feature that a number of us miss from IntelliJ, so we’ve added it. It even has the same keyboard shortcut – Ctrl+Shift+J, at least, in the IntelliJ keymap scheme. And this is where we need your feedback. We haven’t added a shortcut for this in the Visual Studio scheme. You can easily do this yourself, by going to Tools → Options → Keyboard and assigning a shortcut to the “ReSharper.ReSharper_JoinLines” command. If you’d like to suggest a default shortcut for the Visual Studio scheme, please add a comment to issue RSRP-461295.

Visual Basic 14 smart name resolution

And finally, we’re fixing a “red code” issue with Visual Basic 14, which ships as part of Visual Studio “15”. Just like VB, we’ll now use “smart name resolution“, by inferring which namespace you meant from conflicting choices based on the type you’re using. For example, if you use Threading.Thread, you clearly meant System.Threading.Thread, and if you use Threading.Dispatcher, we understand that you mean System.Windows.Threading.Dispatcher.

ReSharper C++ and its tooltips

Starting in EAP 4, ReSharper can now display rich, syntax highlighted tooltips for C++ code elements. The tooltips will display method and field signatures, as well as formatting any doxygen doc comments.

ReSharper C++ rich tooltips

To enable, make sure the the check the “Replace Visual Studio tooltips” option is checked in the Editor → Appearance options page.


As ever, please download the EAP and take it out for a spin, and let us know about any issues you encounter.

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

ReSharper Ultimate 2016.3 EAP. What’s new in builds 2 and 3

We’re up to build number 3 in the ReSharper Ultimate 2016.3 EAP. Let’s take a look at what’s changed in the last couple of builds.

Visual Studio 15 and new language versions

Firstly, EAP3 adds support for VS “15” Preview 5. As ever with a preview Visual Studio release, there may be issues with integration (we’re aware of potential issues with MSTest discovery), and we’re still working on adding support for some of the new functionality, so please let us know if you encounter anything that isn’t working right.

We’re also hard at work on C# 7.0 and VB.NET 15 support. The latest builds understand VB.NET binary literals and digit separators, and introduces basic support for C# 7.0 out variables.

C# also gets a nice new typing assist: when you type  $ to start an interpolated string literal, ReSharper will automatically complete the  $"" and insert the text caret between the quotes.

Finally for C#, another small addition that demonstrates a very powerful feature of ReSharper’s Structural Search and Replace – the “match similar constructs” feature now matches integer constants, regardless of how they’re encoded.

JavaScript and TypeScript

JavaScript and TypeScript get a new options page that improves how ReSharper works with third party library code and generated code. From this page, you can mark a JavaScript, TypeScript or JSON file, by name, file mask or even an entire folder as either “skipped” or “library”.

Skipped code is completely ignored by ReSharper – we will not index the file at all. This is useful when you have a file in your project that ReSharper would normally recognise as JavaScript, TypeScript or JSON – perhaps a generated, minified file, or a script that is already gzipped, but you don’t want the contents to appear in code completion or navigation.

Library code is treated as non-user code by ReSharper. The contents are still indexed, and appear in code completion and navigation, but inspections are not run. Useful for including third party code, e.g. jquery.js, where you don’t maintain the code yourself, and ReSharper’s inspections are not relevant to you.

Third party code options dialog

ReSharper C++

ReSharper C++ has had some updates, too, starting with more memory optimisations, as well as adding support for the Catch C++ unit test framework. We now also support analysing C++ as part of the ReSharper Command Line Tools, meaning you can generate an XML report as part of a CI build.

.NET Core

EAP 1 introduced support for running .NET Core unit tests for NUnit and xUnit.net, and with the new EAPs, you can now debug .NET Core tests, as well.

And speaking of xUnit.net, we’ve fixed a performance issue that could freeze the UI if you had a “theory” test that generated a very large number of test rows at runtime.

As ever, please download and give it a go. And if you encounter any issues, please let us know!

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