Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Implement a DisposeAsync method
description: Learn how to implement DisposeAsync and DisposeAsyncCore methods to perform asynchronous resource cleanup.
author: IEvangelist
ms.author: dapine
ms.date: 11/30/2022
ms.date: 01/02/2023
dev_langs:
- "csharp"
helpviewer_keywords:
Expand Down Expand Up @@ -49,10 +49,8 @@ public async ValueTask DisposeAsync()
// Dispose of unmanaged resources.
Dispose(false);

#pragma warning disable CA1816 // Dispose methods should call SuppressFinalize
// Suppress finalization.
GC.SuppressFinalize(this);
#pragma warning restore CA1816 // Dispose methods should call SuppressFinalize
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ public async ValueTask DisposeAsync()
await DisposeAsyncCore().ConfigureAwait(false);

Dispose(disposing: false);
#pragma warning disable CA1816 // Dispose methods should call SuppressFinalize
GC.SuppressFinalize(this);
#pragma warning restore CA1816 // Dispose methods should call SuppressFinalize
}

protected virtual void Dispose(bool disposing)
Expand Down