{"id":331552,"date":"2023-03-10T15:45:24","date_gmt":"2023-03-10T14:45:24","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=dotnet&#038;p=331552"},"modified":"2023-03-10T16:42:52","modified_gmt":"2023-03-10T15:42:52","slug":"rider-2023-1-eap-8","status":"publish","type":"dotnet","link":"https:\/\/blog.jetbrains.com\/dotnet\/2023\/03\/10\/rider-2023-1-eap-8\/","title":{"rendered":"Rider 2023.1 EAP 8 Is Here With Improved C# and F# Support, New Editor Features and Fixes for Unity"},"content":{"rendered":"\n<p>The Early Access Program for Rider 2023.1 has brought many exciting updates to your favorite .NET IDE, and the EAP 8 build that\u2019s just been released is yet another step on our path toward the next stable release.<\/p>\n\n\n\n<p>Before you <a href=\"https:\/\/www.jetbrains.com\/rider\/nextversion\/\" target=\"_blank\" rel=\"noopener\">download<\/a> it, let\u2019s take a look at the updates in this build.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"2560\" height=\"1200\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/Blog_Featured_image_1280x600-2x-2.png\" alt=\"\" class=\"wp-image-331554\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">C# support<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Insert a return type specification for lambdas<\/h3>\n\n\n\n<p>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, <em>Insert parameter signature<\/em>, has been around<em> <\/em>for a while.<\/p>\n\n\n\n<p>Starting from C# 11, adding a return type specification for lambda expressions is also possible. To accomplish this, we introduced a new context action, <em>Insert return type specification,<\/em> in version 2023.1. You can apply it to all lambda expressions in scopes like method, class, file, project, or an entire solution.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/rd-cs-lambda-return.png\" width=\"800px\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/rd-cs-lambda-return.gif\">\n\n\n\n<h3 class=\"wp-block-heading\">Syntax style for null checking patterns<\/h3>\n\n\n\n<p>We provided the new &#8220;Syntax style&#8221; setting to help you enforce one consistent style of <em>not null<\/em> 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 <em>Settings\/Preferences | Editor | Code Style | C# | Syntax Style <\/em>tab.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1200\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/rd-cs-null-check-pattern-settings-1.png\" alt=\"\" class=\"wp-image-332075\"\/><\/figure>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/rd-cs-null-check-pattern.png\" width=\"800px\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/rd-cs-null-check-pattern.gif\">\n\n\n\n<p>There is a disadvantage to using the <code>not null <\/code>pattern \u2013 you cannot introduce variable names for the checked value as you can with the recursive pattern <code>{ LastName: { } lastName }<\/code>. Workarounds like <code>{ LastName: not null and var lastName }<\/code> are not as concise as a recursive pattern. <\/p>\n\n\n\n<p>To help resolve this, we&#8217;ve added the <em>Add pattern variable<\/em> context action over the not null pattern. This <em>Add pattern variable<\/em> 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.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/rd-cs-add-pattern-variable.png\" width=\"800px\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/rd-cs-add-pattern-variable.gif\">\n\n\n\n<h3 class=\"wp-block-heading\">ArgumentNullException.ThrowIfNull style of null checks<\/h3>\n\n\n\n<p>.NET 6.0 SDK introduced a new API for null checking \u2013 <code>ArgumentNullException.ThrowIfNull<\/code>. 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 <code>null<\/code> checks produced in Rider. In the 2023.1 release, we added an <code>ArgumentNullException.ThrowIfNull<\/code> pattern to <em>Settings\/Preferences | Editor | Code Style | C# | Null checking<\/em> for Rider.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1200\" height=\"500\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/rd-cs-throwifnull-settings-1.png\" alt=\"\" class=\"wp-image-332155\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><em>Pattern is redundant<\/em> inspection<\/h3>\n\n\n\n<p>C# or\/and\/not patterns can be useful to produce compact value checks without repeating the input value reference (<code>value == 1 || value == 2 <\/code>vs. <code>value is 1 or 2<\/code>). However, this syntax is still not as recognizable as good-old expressions like <code>||\/&amp;&amp;\/!<\/code>. Pattern priorities are not that clear at first, so it is easy to miss parentheses and introduce hard-to-find bugs.<\/p>\n\n\n\n<p>For example, the expression <code>value is not 0 or -1 <\/code>compiles without any warnings. When the user\u2019s intention is to check the value for being not equal to both <code>0<\/code> or <code>1<\/code>, this check will evaluate to true with the value being equal to <code>-1<\/code>. The correct pattern to use would be <code>value is not (0 or -1)<\/code>.<\/p>\n\n\n\n<p>To help with situations like this, we introduced a new code analysis in version 2023.1 to warn you about &#8220;dead&#8221; checks inside complex patterns. Usually, those redundant &#8220;dead&#8221; pattern checks indicate a problem with a complex pattern.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><em>Convert to list pattern<\/em> context action<\/h3>\n\n\n\n<p>We\u2019re continuing to improve our support for C# 11 list patterns. With the new <em>Convert to list pattern<\/em> 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.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/rd-cs-sonvert-to-list-pattern.png\" width=\"800px\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/rd-cs-sonvert-to-list-pattern.gif\">\n\n\n\n<h2 class=\"wp-block-heading\">Editor<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Option to specify the placement of pasted content<\/h3>\n\n\n\n<p>In Rider 2023.1, there\u2019s now a special setting that allows you to control the placement of pasted content. In <em>Settings\/Preferences | Advanced Settings<\/em>, find the <em>Editor<\/em> section and select the desired behavior for the <em>Paste<\/em> action from the drop-down list.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1200\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/Rider_Editor_Pasting-Behavior.png\" alt=\"\" class=\"wp-image-332318\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Option to show whitespaces only in selected code<\/h3>\n\n\n\n<p>There\u2019s a new <em>Selection<\/em> checkbox in <em>Settings\/Preferences | Editor | General | Appearance | Show Whitespace <\/em>that allows you to configure this setting so that Rider shows whitespaces as small dots only when you select code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Text filters for unit test trees<\/h2>\n\n\n\n<p>Text search filters inside the <em>Unit Tests <\/em>and <em>Unit Test Coverage <\/em>tool windows are now taken into account when running tests using the toolbar\u2019s <em>Run <\/em>buttons. Only the tests that satisfy the search criteria will remain listed and run.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1200\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/Rider_Filtered-Unit-Tests.png\" alt=\"\" class=\"wp-image-332331\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">F# support<\/h2>\n\n\n\n<p>There&#8217;s a new quick-fix that generates missing pattern branches in a match expression.<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/fsharp_quickfix.png\" width=\"800px\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/fsharp_quickfix.gif\">\n\n\n\n<h2 class=\"wp-block-heading\">Notable fixes<\/h2>\n\n\n\n<p>Rider 2023.1 EAP 8 comes with a number of fixes for working with Unity projects:<\/p>\n\n\n\n<ul><li>We\u2019ve solved an issue where Rider was not showing usages of the Script method in <em>Animator<\/em> controllers in the <em>Code Vision<\/em> view (<a href=\"https:\/\/youtrack.jetbrains.com\/issue\/RIDER-84724\/Investigate-improve-MetaTracker\" target=\"_blank\" rel=\"noopener\">RIDER-84724<\/a>).<\/li><li>We\u2019ve fixed a bug interfering with Rider\u2019s ability to save files or sync scripts with Unity when the user switches to a different application (<a href=\"https:\/\/youtrack.jetbrains.com\/issue\/RIDER-62051\/Save-file-when-switching-application-and-different-monitors\" target=\"_blank\" rel=\"noopener\">RIDER-62051<\/a>).<\/li><li>We\u2019ve restored Rider\u2019s ability to display XML docs in the <em>Quick Documentation <\/em>pop-up window in Unity projects (<a href=\"https:\/\/youtrack.jetbrains.com\/issue\/RIDER-89954\/XML-docs-missing-in-Quick-Documentation-pop-up-in-a-Unity-project\" target=\"_blank\" rel=\"noopener\">RIDER-89954<\/a>).<\/li><li>We\u2019ve fixed an issue with <em>Run to Cursor<\/em> not working when debugging Blazor web applications (<a href=\"https:\/\/youtrack.jetbrains.com\/issue\/RIDER-65451\/Run-to-cursor-doesnt-work-when-debug-blazor-web-application\" target=\"_blank\" rel=\"noopener\">RIDER-65451<\/a>).<\/li><li>We\u2019ve resolved the issue of Unity meta files being corrupted whenever the user reverts using <em>LocalHistory<\/em> (<a href=\"https:\/\/youtrack.jetbrains.com\/issue\/RIDER-84724\/Investigate-improve-MetaTracker\" target=\"_blank\" rel=\"noopener\">RIDER-84724<\/a>).<\/li><\/ul>\n\n\n\n<p>For the full list of resolved issues, please refer <a href=\"https:\/\/youtrack.jetbrains.com\/issues\/RIDER?q=Available%20in:%20%7B2023.1%20EAP%208*%7D\" target=\"_blank\" rel=\"noopener\">to our issue tracker<\/a>.<\/p>\n\n\n\n<p>That\u2019s it for now!<\/p>\n\n\n\n<p>Please share your opinion on Rider\u2019s latest EAP builds in the comments below or on social media.<\/p>\n","protected":false},"author":1337,"featured_media":331554,"comment_status":"closed","ping_status":"closed","template":"","categories":[4992,89,907,4140],"tags":[2104,7073,600,2005,1978],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/dotnet\/331552"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/dotnet"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/types\/dotnet"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/users\/1337"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=331552"}],"version-history":[{"count":10,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/dotnet\/331552\/revisions"}],"predecessor-version":[{"id":332343,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/dotnet\/331552\/revisions\/332343"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media\/331554"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=331552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=331552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=331552"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/cross-post-tag?post=331552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}