Dotnet logo

.NET Tools

Essential productivity kit for .NET and game developers

.NET Tools News Releases ReSharper Platform

ReSharper 2023.2 EAP 5: Improved Control Over Object Disposal, Support for Default Lambda Parameters, and C++23 Standard Library Modules.

The latest build for the ReSharper 2023.2 Early Access Program is available for download from our website. 

Let’s take a look at what’s inside!

C# support

Support for default parameter values in lambdas

As part of our work on supporting C# 12 language updates, we’re introducing support for default parameter values in lambda expressions in ReSharper 2023.2. In addition to the standard set of warning messages associated with recognizing this syntax, we’ve also tweaked an existing inspection, The parameter has the same default value, to account for default parameter values in lambdas. This inspection will also be triggered when an invocation has an argument value that is the same as the default value of the parameter in the invoked delegate, making the expression redundant.

New inspections for improved control over object disposal

ReSharper 2023.2 introduces two new code inspections designed to address scenarios where the state of a returned object may be negatively influenced by its early disposal or the early disposal of the object that spawned it.

When a variable is captured by a using statement, it ensures that the object is properly disposed of when it goes out of scope. Returning an object captured by a using statement can be problematic because it extends the lifespan of the returned object beyond the method scope, causing the object to be disposed of immediately after returning. This can lead to unexpected behavior and resource-related issues.

The Return of a variable captured by ‘using’ statement inspection alerts you in cases where the returned object is immediately disposed of.

Similarly, the Return of a task produced by ‘using’-captured object inspection identifies scenarios where a Task is produced by an object captured by a using statement and then immediately returned. To extend the lifetime of the disposable object enough for Task completion, a corresponding quick-fix will introduce asynchronous awaiting for that Task before its return. 

C++ support

This EAP build brings support for the C++23 standard library modules and C++20’s [[no_unique_address]] attribute, new code formatter settings, and other updates. 

For more details, please refer to this blog post.

dotTrace

Group by Thread for sampling, tracing, and line-by-line snapshots

dotTrace 2023.2 introduces the Group by Thread option and corresponding button in the Call Tree panel for performance snapshots. This option organizes sampling, tracing, and line-by-line snapshots based on individual threads, allowing for deeper insight into thread-specific performance issues. 

Using this grouping method can also give you a birds-eye view of the project’s performance, as the call trees with the most ancestors will end up at the top of the list, making any hotspots glaringly obvious. 

Once you’ve clicked on the Group by Thread toggle button, you will see the call trees organized by thread. You can navigate from one thread to another by using the keyboard, and the trees will expand at once. Red-colored percentage values to the left of the call tree indicate higher subtree power, helping you pinpoint potential performance bottlenecks at a glance. 

That’s it for now! For the full list of improvements and fixes that made it into the latest EAP build, please check out our issue tracker. As always, we’d love to hear your opinions and suggestions in the comments below.

image description