C# implicitly change nullability of property #2219
Replies: 3 comments
-
Is it a read only property? If not I would think that the nullability analysis is correct. |
Beta Was this translation helpful? Give feedback.
-
@jrmoreno1 I think the ask is to "amend" a property of the base class to indicate that, when accessed via the derived class, there is a guarantee of non-null. I think this can already be accomplished sufficiently, though:
|
Beta Was this translation helpful? Give feedback.
-
We discussed this in LDM earlier this year and decided to support this scenario, but it has not yet been implemented. See https://github.com/dotnet/csharplang/blob/master/meetings/2019/LDM-2019-01-07.md#discussion and the bugs linked from those notes. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This is a proposed improvement of the null checking of properties in C#.
I have a nullable property in the base class (see SearchParameters.Url in the example code). The constructor of the child class (SuccessAnalysisParameters) ensures this property is not null.
When using the child class, I didn't expect a warning to tell me this property can be null. This is a false positive.
This issue has been moved from https://developercommunity.visualstudio.com/content/problem/414634/c-implicitly-change-nullability-of-property.html
VSTS ticketId: 756307
These are the original issue comments:
(no comments)
These are the original issue solutions:
(no solutions)
Beta Was this translation helpful? Give feedback.
All reactions