Skip to content

Update Dispose pattern rule to handle DisposeAsync pattern #3909

@Evangelink

Description

@Evangelink
public async ValueTask DisposeAsync()
{
    await DisposeAsyncCore().ConfigureAwait(false);
    Dispose(false);
    GC.SuppressFinalize(this);
}

protected virtual ValueTask DisposeAsyncCore()
{
    // Async version of code inside `if (disposing)` blocks from Dispose(bool)
}

Originally posted by @bartonjs in #3679 (comment)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions