-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Quality: Convert into await using
statement or declaration
#15092
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Sorry for the unrelated comments, Yair. I don't mind you deleting them. Besides that, I'm onboard where applicable. Basically classes that implement IAsyncDisposable need to release unmanaged objects asynchronously but using Disposable may cause hangs. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
to
In .NET, classes that own unmanaged resources usually implement the IDisposable interface to provide a mechanism for releasing unmanaged resources synchronously. However, in some cases they need to provide an asynchronous mechanism for releasing unmanaged resources in addition to (or instead of) the synchronous one. Providing such a mechanism enables the consumer to perform resource-intensive dispose operations without blocking the main thread of a GUI application for a long time.
The IAsyncDisposable.DisposeAsync method of this interface returns a ValueTask that represents the asynchronous dispose operation. Classes that own unmanaged resources implement this method, and the consumer of these classes calls this method on an object when it is no longer needed.
Source: https://stackoverflow.com/questions/58610350/what-is-the-difference-between-using-and-await-using-and-how-can-i-decide-which
Concerned code
Generated using Jetbrains Rider:
<platforms><Files.App>\Utils\Storage\StorageItems\VirtualStorageItem.cs (1 issue)
<platforms><Files.App>\Utils\Storage\StorageBaseItems\BaseStorageFile.cs (1 issue)
<platforms><Files.App>\Utils\Shell\LaunchHelper.cs (2 issues)
<platforms><Files.App>\Utils\Storage\StorageItems\ZipStorageFile.cs (7 issues)
<platforms><Files.App>\Utils\Storage\StorageItems\VirtualStorageFile.cs (4 issues)
<platforms><Files.App>\Utils\Storage\Operations\ShellFilesystemOperations.cs (4 issues)
<platforms><Files.App>\Utils\Storage\StorageItems\ZipStorageFolder.cs (9 issues)
<platforms><Files.App>\Utils\Storage\StorageItems\NativeStorageFile.cs (4 issues)
<platforms><Files.App>\Utils\Storage\StorageItems\SystemStorageFile.cs (9 issues)
<platforms><Files.App>\ViewModels\Properties\HashesViewModel.cs (1 issue)
<platforms><Files.App>\Utils\Storage\StorageItems\FtpStorageFile.cs (3 issues)
<platforms><Files.App>\Utils\Cloud\Detector\SynologyDriveCloudDetector.cs (3 issues)
<platforms><Files.App>\Utils\Cloud\Detector\GoogleDriveCloudDetector.cs (3 issues)
<platforms><Files.App>\Services\SideloadUpdateService.cs (2 issues)
<platforms><Files.App>\Services\UpdateService.cs (2 issues)
<platforms><Files.App>\Extensions\ImageSourceExtensions.cs (1 issue)
Gains
Requirements
async using
Comments
It's possible to make a single PR using this button :)
The text was updated successfully, but these errors were encountered: