Skip to content

CS8600: Should report on methods that returns ConfiguredTaskAwaitable #39417

@skarllot

Description

@skarllot

Version Used: Visual Studio 2019 Version 16.3.5

Steps to Reproduce:

static class TaskExtensions
{
    public static ConfiguredTaskAwaitable<TResult> NoSync<TResult>(this Task<TResult> task)
    {
        return task.ConfigureAwait(false);
    }
}

class Request
{
    public string? Name { get; }
    public Task<string?> GetName() => Task.FromResult(Name);
}

class Handler
{
    public async Task Handle(Request request)
    {
        string a = request.Name;    // <-- CS8600
        string b = await request.GetName().ConfigureAwait(false);    // <-- CS8600
        string c = await request.GetName().NoSync();    // <-- No warning here
    }
}

Expected Behavior:
CS8600 to be reported when using NoSync method extension.

Actual Behavior:
CS8600 is not reported when using NoSync method extension.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions