Dotnet logo

.NET Tools

Essential productivity kit for .NET and game developers

.NET Tools News Releases Rider

Rider 2023.1 EAP 8 Is Here With Improved C# and F# Support, New Editor Features and Fixes for Unity

The Early Access Program for Rider 2023.1 has brought many exciting updates to your favorite .NET IDE, and the EAP 8 build that’s just been released is yet another step on our path toward the next stable release.

Before you download it, let’s take a look at the updates in this build.

C# support

Insert a return type specification for lambdas

Lambda expressions in C# usually have implicitly-typed parameters and an inferred return type. Sometimes, it can be useful to add explicit types in a signature of a lambda expression to make code clearer or to help C# type inference in some complex scenarios involving overload resolution. A context action to insert parameter types, Insert parameter signature, has been around for a while.

Starting from C# 11, adding a return type specification for lambda expressions is also possible. To accomplish this, we introduced a new context action, Insert return type specification, in version 2023.1. You can apply it to all lambda expressions in scopes like method, class, file, project, or an entire solution.

Syntax style for null checking patterns

We provided the new “Syntax style” setting to help you enforce one consistent style of not null checks inside patterns. It consists of 2 options: empty recursive pattern syntax { } and negated pattern not null, where the latter is set by default. You can adjust this behavior by going to Settings/Preferences | Editor | Code Style | C# | Syntax Style tab. 

There is a disadvantage to using the not null pattern – you cannot introduce variable names for the checked value as you can with the recursive pattern { LastName: { } lastName }. Workarounds like { LastName: not null and var lastName } are not as concise as a recursive pattern.

To help resolve this, we’ve added the Add pattern variable context action over the not null pattern. This Add pattern variable context action now looks for expressions accessing the same value (since we are introducing a variable name) and replacing all of them with the newly introduced name to consolidate all accesses to the same value.

ArgumentNullException.ThrowIfNull style of null checks

.NET 6.0 SDK introduced a new API for null checking – ArgumentNullException.ThrowIfNull. Our code analysis engine has recognized this checking approach since then, but there was no option to use this API as a default style of null checks produced in Rider. In the 2023.1 release, we added an ArgumentNullException.ThrowIfNull pattern to Settings/Preferences | Editor | Code Style | C# | Null checking for Rider.

Pattern is redundant inspection

C# or/and/not patterns can be useful to produce compact value checks without repeating the input value reference (value == 1 || value == 2 vs. value is 1 or 2). However, this syntax is still not as recognizable as good-old expressions like ||/&&/!. Pattern priorities are not that clear at first, so it is easy to miss parentheses and introduce hard-to-find bugs.

For example, the expression value is not 0 or -1 compiles without any warnings. When the user’s intention is to check the value for being not equal to both 0 or 1, this check will evaluate to true with the value being equal to -1. The correct pattern to use would be value is not (0 or -1).

To help with situations like this, we introduced a new code analysis in version 2023.1 to warn you about “dead” checks inside complex patterns. Usually, those redundant “dead” pattern checks indicate a problem with a complex pattern.

Convert to list pattern context action

We’re continuing to improve our support for C# 11 list patterns. With the new Convert to list pattern context action, you can turn collection length checks into a list pattern syntax. It works in any context where a collection length check can be done.


Option to specify the placement of pasted content

In Rider 2023.1, there’s now a special setting that allows you to control the placement of pasted content. In Settings/Preferences | Advanced Settings, find the Editor section and select the desired behavior for the Paste action from the drop-down list.

Option to show whitespaces only in selected code

There’s a new Selection checkbox in Settings/Preferences | Editor | General | Appearance | Show Whitespace that allows you to configure this setting so that Rider shows whitespaces as small dots only when you select code.

Text filters for unit test trees

Text search filters inside the Unit Tests and Unit Test Coverage tool windows are now taken into account when running tests using the toolbar’s Run buttons. Only the tests that satisfy the search criteria will remain listed and run.

F# support

There’s a new quick-fix that generates missing pattern branches in a match expression.

Notable fixes

Rider 2023.1 EAP 8 comes with a number of fixes for working with Unity projects:

  • We’ve solved an issue where Rider was not showing usages of the Script method in Animator controllers in the Code Vision view (RIDER-84724).
  • We’ve fixed a bug interfering with Rider’s ability to save files or sync scripts with Unity when the user switches to a different application (RIDER-62051).
  • We’ve restored Rider’s ability to display XML docs in the Quick Documentation pop-up window in Unity projects (RIDER-89954).
  • We’ve fixed an issue with Run to Cursor not working when debugging Blazor web applications (RIDER-65451).
  • We’ve resolved the issue of Unity meta files being corrupted whenever the user reverts using LocalHistory (RIDER-84724).

For the full list of resolved issues, please refer to our issue tracker.

That’s it for now!

Please share your opinion on Rider’s latest EAP builds in the comments below or on social media.

image description