[Proposal] Extend MemberNotNullAttribute
to support ReturnValue
as a target
#74534
Unanswered
hwoodiwiss
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've come across cases a number of times where I have a method that guarantees that a child property on a type that it returns will be a non-null value, but to my knowledge there is no way at the moment to annotate the method to be able to indicate this for nullability static analysis.
For example:
It would be useful to be able to annotate
CreateParent
with[return: MemberNotNull(nameof(ParentClass.Child))]
and have that information be captured in the nullability analysis to avoid that warning.Beta Was this translation helpful? Give feedback.
All reactions