-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Return values of SingleOrDefaultAsync incorrect when nullable reference types are enabled #21793
Comments
Simply adding [MaybeNull] isn't the right solution here for the async methods, see #21794 (comment). |
Duplicate of #19007 |
@dannyBies T? is being added for C# 9, which would be the correct annotation for this (as it allows annotating the nested generic type parameter): dotnet/roslyn#45993 |
That's great, thanks for letting me know! Any idea when this will be usable in this project? I can make the necessary changes once T? is available here. |
We're definitely not going to be doing any nullability annotation work for the upcoming 5.0 release (which is being stabilized), but I really hope we have time to that for 6.0. Track #19007 to know what's going on. |
In my project I have nullable reference types enabled.
<Nullable>enable</Nullable>
I believe the return type is incorrect for the following methods in EntityFrameworkQueryableExtensions.cs
I believe those methods should use the [return: MaybeNull] attribute just like equivalent System.Linq methods do.
Steps to reproduce
I would expect a build error at foundInvite.Expired as this could return null.
Further technical details
EF Core version: 5.0.0-preview.7.20365.15
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET5
Operating system: Windows 10
IDE: 16.7.0 Preview 5.0
The text was updated successfully, but these errors were encountered: