Performance Profiling in Rider 2018.3. What’s New?

If you’re an active Rider 2018.3 user or just follow our blog, you probably know that Rider just got an integrated performance profiler based on JetBrains dotTrace. Though we’ve already reviewed the profiler features on the EAP stage, the release version brings some important changes, especially concerning profiling session configuration. Read this post to learn more about the changes.
Continue reading

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

SOLID Veteran or Copy/Paste Master? Finding duplicate code

Of course, life is not only black and white. Quite often, code duplication can be introduced unintentionally, which is even more likely in bigger teams. The reasons don’t really matter. What’s more important is to have tools at hand. Tools that help to reliably detect code duplication in growing and evolving codebases.

In today’s episode, we’ll cover the dupFinder command-line tool, which can find duplicates in C# and VB.NET code! It is available from the ReSharper Command-Line Tools NuGet package or as a TeamCity build step. Since it is free, it’s also perfect to use in any other continuous integration (CI) or DevOps-related environments.

Note: DupFinder is currently only supported on Windows. There is a YouTrack issue if you like to stay informed about support for other platforms.

What is code duplication?

Obviously, copying and pasting is code duplication in its simplest form. A more subtle phenomenon is that developers independently write code that is similarly structured, but has differences in identifier naming, code formatting, and code style.

In dupFinder, the similarity of code fragments is weight in costs. The costs are provided in a relative unit, such as with cyclomatic complexity. The bigger the costs, the bigger the fragments of code duplication.

Gathering duplication metrics

DupFinder is a CLI tool and can be invoked on solution files, folders or individual files. A common requirement would also be to exclude generated code:

dupFinder FunkyApp.sln --output=report.xml --exclude=“**/*.Generated.cs”

Right at the top of the generated XML report, there will be accumulated statistical data, which could be used for historical analysis:

More interestingly, it also contains individual data about discovered duplicates. This includes the actual costs of the duplication as well as file name, line offsets and column offsets for the related fragments:

Depending on our solution, we might need to play with the --discard-cost parameter, which acts as a costs threshold to make the result set most relevant. We may also decide to add the --show-text parameter, to include the actual code in the report. Plenty of additional command-line options are explained in our help documentation.

Human-readable reports

Certainly, dangling through XML is not the most efficient way of analyzing a report. By applying a custom XSL transformation, we can make this much more readable. Out-of-the-box, TeamCity shows a new Duplicates report tab, which allows to navigate through the result by scope and show the fragments side-by-side:
DupFinder Duplicates Report in TeamCity

Avoid duplication as you type

Going beyond the capabilities of the dupFinder CLI, ReSharper (and Rider) can help to avoid often recurring duplicates just in time. Suppose you’ve identified a fragment and encapsulated it into its own method so that it can be called more concisely from anywhere in the codebase. Still, your fellow developers use the old fragment over and over again. This is a good time to create a custom SSR pattern, which would show a code inspection just at the moment the duplicate is written.

Download ReSharper or give Rider a try. We’d love to hear your feedback!

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

Performance Improvements in ReSharper 2018.3

Today, we would like to tell you about our recent efforts aimed at making ReSharper faster. We’ll explore the four crucial performance improvements we’ve made in the 2018.3 release cycle:

  • Refactoring the loading of assemblies
  • Keyword completion
  • Code completion in general
  • Asynchronous value tracking

Let’s have a look!
Continue reading

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

Typing Assists, Code Analysis for Unused Opens, and More F# Updates in Rider

In our latest Rider 2018.3 release, we have made a number of updates to F# functionality: a bunch of new typing assists for brackets, quotes, indenting and more, code analysis for unused opens (and an optimize opens quick-fix), renaming of local symbols, updates to how Find Usages handles union cases and type specifications, and a fresh F# lexer. Let’s see!

Continue reading

Posted in How-To's | Tagged , , , , | 1 Comment

A Look at what’s new in Rider 2018.3: Code Completion, TODO and More

We have already looked at the many new and improved features of Rider! Let’s look at even more available in the Rider 2018.3 version.

Rider 2018.3 Splash Screen

We are going to look at what’s new in Code Completion with regards to Package references, configuration files and more! In addition, we will also look at changes with how Rider recognizes and displays TODO patterns. Continue reading

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

Rider 2018.3.1 bug-fix update is here

Last week, we were in a hurry to deliver the first hotfix for Rider 2018.3 this year. And here it is! You are very welcome to download the Rider 2018.3.1 build right now.

Rider 2018.3.1 comes with fixes for:
Continue reading

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

ReSharper Ultimate 2018.3.1 bug-fix update is here

Today, we invite you to download the first bug-fix build for ReSharper Ultimate 2018.3 release – ReSharper Ultimate 2018.3.1.

This bug-fix update resolves the following issues:
Continue reading

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

Rider 2018.3 is released!

Excellent news, everyone! We’ve just released Rider 2018.3 with lots of features you’ve been waiting for and all kinds of improvements to make coding easier still.

Rider 2018.3 is released

Let’s dive into this ocean of improvements and features:
Continue reading

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

ReSharper Ultimate 2018.3 is released!

I’m here today to present to you this year’s last major release of ReSharper Ultimate. Don’t feel like reading? Then come and grab ReSharper Ultimate 2018.3!

ReSharper Ultimate 2018.3 released

Let me show you what the ReSharper team has accomplished in this release: Continue reading

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

.editorconfig updates, more build options, better Roslyn support in Rider 2018.3 EAP

Last time, we looked at several new features and fixes available in the Rider 2018.3 Early Access Preview (EAP) version – but definitely not all of them! There are more things to cover…

We have more flexibility for building .NET and .NET Core solutions. We have exciting news about the Roslyn analyzers in Rider. Plus a few more things – you will want to continue reading to learn about. Continue reading

Posted in How-To's | Tagged , , | 1 Comment