Skip to content

Feature request: Prefer "await using" over "using" inside async methods #14

@devax

Description

@devax

Thank you for this great extension!

I have realized that I often miss the presence of IAsyncDisposable interfaces and there is no warning that indicates this. Example:

static async Task Main(string[] args)
{
    using SqlConnection connection = new SqlConnection();
    // Do something with connection
    // ...
}

This could (should?) be converted to:

static async Task Main(string[] args)
{
    await using SqlConnection connection = new SqlConnection();
    // Do something with connection
    // ...
}

Would it be a good idea to add a warning or an information, that await using could be used instead of using?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions