JetBrains Rider 2024.1 Help

Code inspection: Convert into 'await using' statement or declaration

This inspection suggests that you utilize await using instead of using because the object created in the using statement or declaration implements the IAsyncDisposable interface.

The IAsyncDisposable interface provides an asynchronous version of the Dispose() method that non-blocking code can call. Classes that implement IAsyncDisposable normally have some asynchronous cleanup code, such as closing database connections, flushing buffers, and so on. await using ensures that asynchronous cleanup operations execute without blocking the calling thread, enabling proper cleanup of asynchronous resources without compromising performance.

Last modified: 29 May 2024