Skip to content

IDISP013 False Positive? #581

Open
Open
@Bouke

Description

@Bouke

IDISP013 triggers in the following situation:

private async Task IDISP013()
{
    using var client = new HttpClient();

    Func<Task<HttpResponseMessage>> f = () => client.GetAsync("");
    //                                        ^^^^^^^^^^^^^^^^^^^ Await in using

    await f();
}

I believe this to be a false positive, as f is executed within the scope of the using. -- When f wasn't awaited I can see there being an issue where client would've been disposed before GetAsync finished.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions