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

Nullability tracking is broken for Nullable<T> with awaits #76886

Open
stephentoub opened this issue Jan 23, 2025 · 0 comments
Open

Nullability tracking is broken for Nullable<T> with awaits #76886

stephentoub opened this issue Jan 23, 2025 · 0 comments
Labels
Area-Compilers Bug Feature - Nullable Reference Types Nullable Reference Types untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@stephentoub
Copy link
Member

Version Used:
Version 17.14.0 Preview 1.0 [35717.212.main]

Steps to Reproduce:

MyStruct? myStruct = await GetStructAsync();
MyStruct s1 = myStruct.Value;

static async Task<MyStruct?> GetStructAsync()
{
    await Task.Yield();
    return new MyStruct();
}

struct MyStruct { }

Diagnostic Id:

n/a

Expected Behavior:
This should produce warning CS8629: Nullable value type may be null. when accessing .Value.

Actual Behavior:
No warning.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 23, 2025
@jcouv jcouv added Bug Feature - Nullable Reference Types Nullable Reference Types labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Feature - Nullable Reference Types Nullable Reference Types untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

2 participants