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.

ReSharper

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

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

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

Download

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.

ReSharper

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.

Download

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

Establishing a zero-warning policy with ReSharper’s solution-wide analysis

With the release of ReSharper 2016.2 we’ve announced a new feature called warnings in solution-wide analysis.

Basically, it means that after fixing all errors shown in the solution-wide analysis view, you will get a list of all warnings. When integrated both in your IDE and your TeamCity server, we think that this approach will appeal to developers striving for a high-quality code base, because it enables us to establish a zero-warning policy.

Let’s take a look at some random project as an example. We can see that it’s pretty much in a good condition; solution-wide analysis shows a green indicator:

ReSharper without warnings in solution-wide analysis

TeamCity build is also okay:

TeamCity build status

If you look more closely, the opened file contains warnings, but solution-wide analysis is still showing green. Apparently, they’re out-of-sync. Let’s fix this :)

In the following sections we will explain how your project and TeamCity needs to be configured to better reflect on errors and warnings reported by ReSharper. Most importantly, we will show how your development cycle can benefit from this setup. In conclusion, we will discuss a couple of related factors.

Configuring TeamCity

In order to configure TeamCity, you can either use a predefined build step or the ReSharper Command Line Tools package. If you use the package, make sure to set up a service message to import the XML report that will be produced.

A typical build step configuration would look like this:

TeamCity build step configuration

Whether you use the build step or the package, in both cases inspectcode.exe <SolutionFile>.sln  is called. For more information on available customization options, see inspectcode.exe /help .

Now, here’s the most important part of enforcing a zero-warning policy: if you want the build to fail when any errors or warnings exist, you need to configure a new build failure condition, preferably both for errors and warnings:

Alternatively, you can set the current number of warnings as a threshold to prevent it from growing, or set a percentage that must not be exceeded.

Next time you execute the build configuration, the summary page should include a Code Inspection tab, which lists all issues. In addition, the build can now be marked as failed due to violated inspections:

TeamCity Code Inspection tab

Configuring ReSharper

In ReSharper, establishing a zero-warning policy requires (1) turning on warnings in solution-wide analysis and (2) reviewing inspection severity settings.

Since ReSharper has a layered settings system, there are multiple ways to save the configuration of warnings in solution-wide analysis. For the enforcement of a zero-warning policy, we encourage you to use the solution team-shared layer for that setting.

Through the UI, you can enable warnings by toggling the new toolbar button in Errors/Warnings in Solution view, which will be saved to the this computer layer:

Enabling warnings via Errors/Warnings in Solution tool window

Alternatively, navigate to the Code Inspections Settings option page, and enable Include warnings. When saving, you can select the layer:

Enabling warnings via Options dialog

Keeping default inspection settings will do just fine for a start. However, for maximum benefit, there should be as many inspections as possible configured as errors/warnings in the solution team-shared layer as well. Especially inspections currently configured as suggestion are good candidates to change. Just sit together as a team and try to find your common ground.

Inspection severity options

If you want to change an inspection severity spontaneously, just do it from the editor:

Changing inspection severity from the editor

Whenever it is really necessary, you can use various styles of suppression comments to ignore an inspection.

Improved development cycle

Now that we’ve completed our configuration, the Errors/Warnings in Solution tool window has become a two-staged view for all severe issues in our solution. If there are any errors, then only errors will be shown. As soon as the last error is fixed, it will only contain warnings. In order to easily navigate through either errors or warnings, you can use ReSharper | Inspect | Next Error/Warning in Solution.

Warnings in ReSharper solution-wide analysis

By using parallel build configurations in TeamCity (the so-called snapshot dependencies), your team will also benefit from a fast feedback loop: right after implementing a feature and making the solution compilable, you can just push your changes and trigger TeamCity to report about test execution, code coverage and similar. Meanwhile, you are free to resolve all the remaining warnings using quick-fixes and refactorings provided by ReSharper.

Remarks

Ignoring errors/warnings

As some may already have noticed, warnings cannot be ignored in the Errors/Warnings in Solution view. The initial problem with that was the discrepancy between the two-staged view and the existing feature to show ignored errors. Examining this feature a little further revealed that ignored errors are only persisted in caches. So let’s put this aside! We suggest three other solutions to false positive inspections:

  1. Suppress inspections in scope. Recommended when you only have a few false positives.
  2. Change severity of inspections. Useful with broken or unreliable inspections.
  3. Exclude items from analysis. Best used with generated code.

If none of the mentioned alternatives work for you, please leave us a comment explaining why you’re more into ignoring errors. We’d appreciate that! :)

Extensions

As you may know, the existing set of inspections can be extended using plugins from the ReSharper gallery. Unfortunately, those extensions are currently only subject to solution-wide analysis inside the IDE. In fact, there is an issue filed to bring back support for extensions in the CLT. As soon as this issue is resolved, we highly recommend you to try extensions like ReSpeller, XmlDoc Inspections, CleanCode or Cyclomatic Complexity, and also include them into your zero-warning policy.

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

ReSharper Ultimate 2016.3 EAP Build 1. Details

Last week we opened the early access program for ReSharper Ultimate 2016.3. Below come details of what’s new in the first build. So far the updates and bug fixes are limited to the mainline ReSharper, but this is only the first build after all.

Unit testing in .NET Core apps

Good news for developers working with .NET Core projects: you can now enjoy ReSharper’s unit testing assistance features for xUnit and NUnit tests.

Note that as of the first EAP build debugging .NET Core tests may not work. We are currently investigating and looking to fix these issues.

Unit testing feature in .NET Core

Early bits of C# 7.0 support

If you already have Visual Studio 15 Preview 4 on your machine, you most certainly have played with some of the new C# 7.0 features. Although the ‘Preview 4’ has only been there for a month, ReSharper 2016.3 already brings basic support for local functions and lets you juggle with digit separators and binary literals:

Digit separators and binary literals

JavaScript, TypeScript, and JSON

  • Structural Navigation now works in JavaScript, TypeScript, and JSON. There are some minor known issues when navigating within TypeScript and we’re working to resolve them.
  • 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.
  • A new quick-fix in TypeScript lets you quickly add type guards to disambiguate unresolved symbols:
    Surround with typeguard quick-fix
  • Initial support of TypeScript 2.0.2 (“2.0 RC”): boolean, number and enum literal types.

Language injection improvements

We continue to further improve the mechanism of language injections. In addition to regular expressions and HTML, ReSharper 2016.3 lets you inject CSS and JSON in C#, JavaScript, and TypeScript strings. As before, there are two ways to do so. You can either use a context action to mark a string literal as containing specific language:

Injecting CSS in a C# string

or you can use comments with the special syntax:

Injecting CSS with comment

In the example above, we add prefix= in the comment to make ReSharper resolve the string syntax as if the ‘#’ prefix is already a part of the CSS expression inside the string. As we start typing, ReSharper suggests us IDs of elements from CSS selectors. You can also use postfix= in the comment in a similar way, such as //language=css prefix=body{ postfix=}.

Unified settings page for context actions

A small usability improvement: there are no more separate setting pages for context actions in specific languages as all of them can be now enabled or disabled in a single page. Use the search box at the top of the page to find actions that you’d like to disable:
Unified settings of context actions

Try this for yourself!

Please download the first build of ReSharper Ultimapte 2016.3 EAP and give it a good try.

As usual, if you encounter any issues with this EAP build, don’t hesitate to report them to ReSharper issue tracker.

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

ReSharper Ultimate 2016.3 EAP opens

We have just opened ReSharper Ultimate 2016.3 Early Access Program, and if you like using the latest technology, go ahead and download the first build.

Changes include further evolution of TypeScript support, more ways to inject languages, initial support for C# 7.0 and .NET Core unit tests.

For details on what’s inside, expect another blog post early next week.

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

dotMemory 2016.2. Compare memory snapshots from different sessions

Along with multiple performance improvements and bug fixes, dotMemory 2016.2 brings one long-awaited feature: comparison of memory snapshots stored in different workspaces (or in other words, snapshots collected in different profiling sessions).

When might this be helpful? Generally, in any situation where the data you need compared cannot, for some reason, be collected in one profiling session. For example, you want to find out how particular code changes affect memory usage in your application. In this case you need at least two profiling sessions: before and after changing the code.

How does it work?

It’s really simple.

Cross-workspace comparison

  1. Profile your application and take snapshot(s), or open an existing workspace.
  2. Click Compare with snapshot from another workspace.
  3. Select a snapshot you want to use as basis.
  4. Select a snapshot for comparison.
  5. Click Compare.

This will open the Cross-workspace comparison view. Here you can see how many objects of a particular type exist in both snapshots. Since it’s impossible to match object lifetime data between sessions, the view won’t show you “new” and “collected” objects (which the regular “within-session” snapshot comparison does show). Nevertheless, in most cases, this data should be enough for further analysis.

Cross-workspace snapshots comparison

For example, you can quickly detect a problem when the same workflow in your application (e.g., before and after you commit changes) leads to a different number of objects in your application’s namespaces.

Consider downloading ReSharper Ultimate and giving this new feature a try.

Posted in dotMemory Tips&Tricks, How-To's | Tagged , | 1 Comment

ReSharper Ultimate 2016.2.2: bug fix to a bug fix

Sometimes, a bug fix release needs a bug fix of its own.

That’s what happened to ReSharper this time: yesterday’s 2016.2.1 release introduced a bug whereby running Code Cleanup would incorrectly introduce access modifiers ahead of static constructors (RSRP-460771).

If you’re affected by this bug, please download and install ReSharper Ultimate 2016.2.2, and apologies for making you update twice.

Try again. Fail again. Fail better. 👈

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

dotTrace 2016.2 adds folding recursive calls in Timeline Viewer

Although dotTrace 2016.2 mainly focuses on performance and bug fixes, it also gets one easy-to-miss yet important new feature, which has to do with how dotTrace Timeline Viewer shows recursive calls.

Recursive call stacks can be deep and difficult to analyze. Before 2016.2, Timeline Viewer showed call stack “as is”, i.e recursive calls were simply shown as they were called — one after another in the stack trace. Of course, on complex call stacks with multiple recursive calls this resulted in almost infinite stack scrolling. Now, dotTrace 2016.2 allows you to fold such calls to simplify stack analysis.

For example, let’s take a look at the call stack of a simple application that recursively copies files from a directory and its subdirectories, and reports the progress (the example below is shown for a directory with 3 subdirectories).

This is how it looked in dotTrace Timeline Viewer 2016.1:

Recursive calls in dotTrace Timeline Viewer 2016.1

And this is how the same stack looks in dotTrace Timeline Viewer 2016.2 when recursive calls are folded:

Folded recursive calls in dotTrace Timeline Viewer 2016.2

dotTrace recalculates the tree of recursive calls (it summarizes call times in all recursive subtrees) and presents the information by function signatures. Folded recursive calls are marked with the Folded call icon.

After you unfold a call (by clicking the Folded call icon), you get the familiar stack representation when all recursive calls are shown one after another as they were called. Unfolded recursive calls are marked with the Unfolded call icon:

Unfolded recursive calls in dotTrace Timeline Viewer 2016.2

Note that you don’t necessarily need to fold the entire recursive call tree. You can also fold/unfold any part of the recursive subtree:
Folded recursive subtree in dotTrace Timeline Viewer 2016.2

We hope you find this feature helpful and that it does help you simplify the analysis of complex call trees. To try it on your own, download ReSharper Ultimate 2016.2.

Posted in dotTrace Tips&Tricks, ReSharper Tips&Tricks | Tagged , | 3 Comments