Proposal: NotNullWhenArgumentIsNonZero attribute #3517
Replies: 7 comments
-
Perhaps general |
Beta Was this translation helpful? Give feedback.
-
We talked about additional overloads to NotNullWhen/MaybeNullWhen for error codes during initial release, but didn't see high enough usage to warrant. However, we did want to see if the community wanted them. @jcouv, I believe you've been tracking these requests?
What's the difference between that and NotNullIfNotNull? |
Beta Was this translation helpful? Give feedback.
-
Ah, right there is such one and on the other hand it doesn’t cover this case. For IntPtr? there are 3 value options , not 2. |
Beta Was this translation helpful? Give feedback.
-
I think that's to say |
Beta Was this translation helpful? Give feedback.
-
Ah, well that's really another big feature request the current flow analysis isn't set up to track. We track null vs not null, not whether a value type is default or not. |
Beta Was this translation helpful? Give feedback.
-
FYI there's a proposal for that: #146 (looks like it's been rejected) |
Beta Was this translation helpful? Give feedback.
-
@alrz It's not quite rejected as it is considered to be done as part of #99. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Background and Motivation
PtrToStructure methods should be annotated as returning non null when pointer is not null
https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal.ptrtostringauto?view=netcore-3.1
Proposal:
Introduce some attribute like:
Beta Was this translation helpful? Give feedback.
All reactions