Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async method with nullable return type can return null #26614

Closed
jcouv opened this issue May 3, 2018 · 1 comment
Closed

Async method with nullable return type can return null #26614

jcouv opened this issue May 3, 2018 · 1 comment

Comments

@jcouv
Copy link
Member

jcouv commented May 3, 2018

Currently, this produces a warning, but it should not.

using System.Threading.Tasks;

public class C {
    public async Task<string?> M() {
        await Task.Delay(10);
        return null; // warning CS8625: Cannot convert null literal to non-nullable reference or unconstrained type parameter.
    }
}

Found in nullable dogfood. Assigned to @cston

@cston
Copy link
Member

cston commented May 4, 2018

Duplicate of #23275.

@cston cston closed this as completed May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants