Skip to content

Incorrect AsyncFixer02 in a synchronous local function #42

@quassnoi

Description

@quassnoi

Reproduce

private async Task Wrapper()
{
    await Task.Run(cpuBoundJob);

    return;

    void cpuBoundJob()
    {
        using var memoryStream = new MemoryStream();
        using var gzipStream = new GZipStream(memoryStream, CompressionMode.Compress, true);
        // do work
        gzipStream.Flush(); // AsyncFixer02: FlushAsync should be used instead of gzipStream.Flush.
    }
}

Expect

No warning, the local function is synchronous and await doesn't work in it.

Actual

AsyncFixer02: FlushAsync should be used instead of gzipStream.Flush.

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