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

Add MaybeNull attribute to EntityFrameworkQueryableExtensions.cs #21794

Closed
wants to merge 2 commits into from

Conversation

dannyBies
Copy link

Fixes #21793

@roji
Copy link
Member

roji commented Jul 26, 2020

The [MaybeNull] attributes you've added to SingleOrDefaultAsync and the rest applies to the entire return value of those methods, i.e. to the Task<TSource>, rather than to the TSource which is what you're looking for. I'm not currently aware of a way to properly annotate these methods for nullability, but the C# team is aware of this (/cc @cartermp).

I hope we'll have the time to annotate all of EF Core's API surface in the 6.0 timeframe - that would include this as well.

@dannyBies
Copy link
Author

dannyBies commented Jul 26, 2020

Good point, I hadn't thought of that. It would indeed be nice to have it annotated as it can result in subtle bugs right now.

@dannyBies dannyBies closed this Jul 26, 2020
@roji
Copy link
Member

roji commented Jul 26, 2020

Agreed, hopefully there will be a solution for annotating this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return values of SingleOrDefaultAsync incorrect when nullable reference types are enabled
2 participants