Unity Assembly Definition Files and Rider 2018.2

Last time, we saw how Rider 2018.2 had added support for Unity’s new Packages to the Unity Explorer. This time, we’ll take a look at how Rider supports a key feature of Packages – Assembly Definition Files, with validation, code completion, navigation and even a little bit of refactoring! Let’s see how Rider can help you author and edit your .asmdef files.

Continue reading

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

Roslyn Analyzer Rulesets and stylecop.json support in Rider 2018.2

Code analysis is an important technique to keep our code clean, readable and free of defects. Besides its own code analysis features, Rider 2018.1 started to add support for Roslyn Analyzers, such as xunit.analyzers, which seamlessly blend into the familiar way of highlighting code inspections, configuring their severities or applying related quick-fixes.

In Rider 2018.2, issues with .NET Core toolsets have meanwhile been fixed. But more importantly, Rider 2018.2 further improves the integration with Roslyn Analyzers by adding support for ruleset files and StyleCop.json configuration files used with StyleCop.Analyzers.

Getting Started

Before we get started, we need to make sure to enable the option Read settings from editorconfig, project settings and rule sets, which is located in Preferences | Editor | Inspections Settings:

Enable support for rule set files

Once enabled, we can start working with rule set files. Continue reading

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

Unity Package Explorer in Rider 2018.2

Rider 2018.2 has been another bumper release for Unity features and updates! Today, we’re going to start a series of blog posts looking at what’s new. We’re going to start with a look at how we’ve integrated Unity packages into the Unity Explorer, and future posts will look at new code analysis features, improvements in the Unity Editor integration and more.

Continue reading

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

C# 7.2 and 7.3 updates for stackalloc

The latest versions of ReSharper 2018.2 and Rider 2018.2 come with support for C# 7.3. In this series, we are looking at these new language features in C# 7.3. Today we will look at the array initializers in stackalloc.

This post is part of a series:

In C#, the stackalloc keyword is used in an unsafe code context to allocate a block of memory on the stack. The stackalloc operator is similar to the _alloca function from the C language. This C# operator is used as a way of manually allocated memory buffers that can be used without type safety checks.

When do you need to use stackalloc?

In an average project, you probably won’t need this. For real-time sensitive scenarios (possibly video or audio), it gives better performance for working with small arrays storing data that is cached locally. In such cases, data is not allocated on the managed heap so no Garbage Collection (GC) is involved – you are only looking at a call to the unsafe array. Also, remember that stackalloc does come with some additional costs with needing to zeroing the allocated memory. If that overhead is too high you can always look at using off-heap solutions for your needs.

Changes with stackalloc in C# 7.2

There are several changes around stackalloc that were done for C# 7.2. Before C# 7.2 you could only use stackalloc as an initializer of local pointer variable and only within unsafe context:

Since C# 7.2, stackalloc is an expression and is valid in conditional expressions and assignment expressions outside of unsafe contexts:

This example also shows that using stackalloc as an expression is now convertible to Span<T> type and also ReadOnlySpan<T>. Also, that unsafe context is not required when stackalloc expression type if converted to Span<T> or ReadOnlySpan<T>.

Changes with stackalloc in C# 7.3

Let’s look at using the new C# 7.3 feature for initializing arrays with stackalloc. Initializing arrays in a safe code context has been around since the inception of C# as in the following:

Using stackalloc to create the same arrays would be written as:


There have been a number of changes to stackalloc that allows the C# operator to be used outside of the unsafe context, in an expression and also now allows for initialization of arrays. With the changes, more developers may find stackalloc useful in their solutions when they need to work directly with the stack memory.

Download ReSharper 2018.2 now! Or give Rider 2018.2 a try. We’d love to hear your thoughts!

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

ReSharper Ultimate 2018.2.3 and Rider 2018.2.3 are released!

We’ve just published two bugfix updates, ReSharper Ultimate 2018.2.3 and Rider 2018.2.3, that you may want to install right away. Here are the fixes we’ve added in both:

In ReSharper Ultimate 2018.2.3:

  • We’ve sped up XAML support a bit (RSRP-471164).
  • 2018.2 release splashes are used instead of EAP ones (RSRP-471471).

In Rider 2018.2.3:

  • Rider correctly calculates C# language version based on the latest value in a csproj file (RSRP-471483).
  • Azure DevOps URLs in NuGet Credential Provider is supported (RIDER-19664).
  • We’ve fixed the Unhandled Exception while running Unity in batchmode (RIDER-19688).

Go ahead and install these builds at your earliest convenience. You’ll find ReSharper Ultimate 2018.2.3 and Rider 2018.2.3 on our site, or just update via Toolbox App.

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

Speeding up solution load and formatting inspections – ReSharper 2018.2

Previously in this series, we have talked about how we’ve sped up EditorConfig support and added performance improvements based on the YouTrack reports you’ve sent us. In this post, we’ll look at the rest of the optimizations, most of them related to reducing solution loading times.

In this series:

So, let’s plunge into the additional performance optimizations that made it into 2018.2.

Fetching project configuration without Visual Studio API

To be ready to build the solution on demand, ReSharper Build needs to collect the Build Configuration for a solution and its projects while creating/loading caches on solution loading.

In previous versions, we used the Visual Studio API to get this information. This led to two issues:

  • Any communication with Visual Studio could be executed only on the UI thread.
  • ReSharper asked for Build Configuration data during solution load, a stage where not necessarily all components would be already loaded and ready to provide the required information.

As a result, it was common for the UI thread to become blocked for a significant period of time while ReSharper waited for a API response.
Continue reading

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

Rider 2018.2.2 is released!

The second pack of bug-fixes for Rider 2018.2 is ready – please welcome the Rider 2018.2.2 update!

In the list below, I will show you the most important fixes in this bugfix update:

  • Paths to Android SDK / NDK now are saved when you click the Save button (RIDER-18864).
  • MSTest unit tests in .NET Core projects can be run again from the editor (RIDER-19209).
  • The spell checker no longer checks Japanese, Chinese, and Korean (RIDER-19127), as well as GUIDs, NuGet package names, and everything in *.*proj files and in build-scripts (RIDER-19206).
  • We’ve fixed one more inability to deploy a Xamarin iOS application (RIDER-19017).
  • Entity Framework support is working again (RIDER-19059 and RIDER-18167).
  • Fixed an error when running karma tests (RIDER-17933).
  • Lots of improvements to support Unity.

For more details, see the whole list of 25+ resolved requests on YouTrack.

As usual, you can download the fresh build from our site or install it via Toolbox App.

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

ReSharper Ultimate 2018.2.2 is released!

Today, we’ve published one more bug-fix update to v2018.2 – ReSharper Ultimate 2018.2.2 is here!

Let me highlight the most notable changes in ReSharper 2018.2.2:

  • More than 20 bugs were eliminated across various Refactorings.
  • Fixes in XAML support include RSRP-471234, RSRP-471373, and RSRP-471345.
  • A dozen or so bug-fixes affecting Unit Testing were implemented.
  • We fixed a load of issues in Code Analysis.

To read more about all the changes in this build, please refer to our issue tracker.

ReSharper C++ 2018.2.2 updates the spell-checking inspection to skip commands in documentation comments. It also fixes two important issues where ReSharper C++ could sometimes fail to parse files with complicated macro expansions, and where it missed some usages when performing usage search. Check out this page for the full list of fixes.

Other ReSharper Ultimate tools have addressed some bugs as well: see fixes for dotCover 2018.2.2, dotMemory 2018.2.2, dotTrace 2018.2.2, and dotPeek 2018.2.2.

Come and grab the ReSharper Ultimate 2018.2.2 build to enjoy all the latest fixes!

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

Webinar – Advanced .NET Debugging Techniques from a Real-World Investigation

You know how it feels. After releasing a new version, a service starts behaving in an unexpected way, and it’s up to you to save the day. But where to start?

Join us Tuesday, September 25th, 16:00 – 17:00 CEST (10:00 AM – 11:00 AM EDT or check other timezones) for our free live webinar, Advanced .NET Debugging Techniques from a Real-World Investigation, with Christophe Nasarre and Kevin Gosse.

Advanced .NET Debugging Techniques from a Real-World Investigation

Criteo processes 150 billion requests per day, across more than 4,000 front-end servers. As part of the Criteo Performance team, our job is to investigate critical issues in this kind of environment.

In this talk, you will follow our insights, mistakes and false leads during a real world case. We will cover all the phases of the investigation, from the early detection to the actual fix, and we will detail our tricks and tools along the way. Including – but not limited to:

  • Using metrics to detect and assess the issue;
  • What you can get… or not from a profiler to make a good assumption;
  • Digging into the CLR data structures with a decompiler, WinDBG and SOS to assert your assumption;
  • Automating memory dump analysis with ClrMD to build your own tools when WinDBG falls short.

To attend this webinar, register here.

About the presenters:

Christophe Nasarre
In addition to developing and shipping software on Microsoft stacks for 25+ years, Christophe Nasarre has been working as a technical reviewer for MSPress, Addison-Wesley and other publishing companies since 1996 on books such as “CLR via C#” and the last editions of Windows Internals.

He is providing tools and insights on .NET and Windows development via his blog. Christophe also presented technical sessions on stage both internally at Microsoft or for ISVs and customers at public events such as Microsoft TechDays Paris.

Kevin Gosse
Kevin Gosse has been using Microsoft .NET technologies for 10 years, across client, server, and mobile applications. He is currently employed at Criteo, where he works on scalability, debugging, and optimization issues.

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

Live templates and file templates in Rider 2018.2

Using live templates and file templates can improve coding efficiency a lot while dealing with repetitive content, boilerplate code and language ceremony. For everyone who hasn’t heard of them:

Invoking templates

In previous versions, we could already invoke existing templates. However, seventy developers can’t be wrong that editing templates in Rider is one of the most wanted features we miss from good ol’ ReSharper times – besides dotCover integration of course! Today we are pleased to announce that the necessary changes have been merged to Rider 2018.2. Be ready to browse and edit live templates and file templates from Rider’s settings dialog!

Learning the basics

Navigating to Rider’s settings dialog, we can find two new nodes Editor | Live Templates and Editor | File Templates. Both nodes can be further expanded to browse available templates by languages. On the right-hand side, we can select from a list of pre-installed and custom templates. Below the list, an editor shows the code for an actual template along with a couple of related settings:

Pre-installed live templates

For both custom and pre-installed templates, we can set a shortcut that specifies how the templates are invoked.

The editor for file templates looks roughly the same:

Pre-installed file templates

Some templates are being used in related quick-fixes and context actions. For instance, the template for Razor MVC View can be invoked from a quick-fix when the view doesn’t yet exist. We can modify this template to our needs and still have it deeply integrated into our development workflow.

Of course, the greatest power is only revealed, when adding custom templates for our individual needs, which can even be shared via DotSettings among our team. So how can we do that?

Continue reading

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