-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Nullable Reference Type for FirstOrDefaultAsync #19443
Comments
@roji Thoughts? |
Is there a master issue tracking issues relating to non-nullable reference types, or is there a document containing known issues or limitations? We're seeing some nullability confusion regarding the values passed in to linq functors or as return values from linq expressions. |
Yeah, we need to annotate our async LINQ extensions for nullability - this is part of #19007. We can close this as a duplicate of that, although there may be value in keeping this open as it's a particularly visible area of the API. Note that System.Linq has already been annotated, so we should be following that (although async may make that a bit challenging).
There's the Nullable Reference Types doc page which contains most information NRTs, I'll add a note about this current limitation. |
Submitted dotnet/EntityFramework.Docs#2022 |
My project has nullable reference types enabled and the following code has the warning CS8619 Nullability of reference types in value of type 'Task' doesn't match target type 'Task<User?>'.
FirstOrDefaultAsync can return null and shouldn't FirstOrDefaultAsync return Task<User?> ?
Further technical details
EF Core version: 3.1.0
Database provider: Npgsql.EntityFrameworkCore.PostgreSQL 3.1.0
Target framework: .NET Core 3.1
Operating system: Windows 10
IDE: Visual Studio 2019 16.4.2
The text was updated successfully, but these errors were encountered: