Is relationship of attributes for null-state static analysis to nullable
value type
questionable?
#4962
-
Let discuss null-state static analysis attributes:
static void Nullable ( [NotNull] ref int? i )
{
} // Warning CS8777 Parameter 'i' must have a non-null value when exiting.
static void Nullable2 ( ref int? i )
{
}
static void NullableTest ()
{
int? i = null;
Nullable (ref i);
Console.WriteLine (i.Value); // No issue here.
Nullable2 (ref i);
Console.WriteLine (i.Value); // Warning CS8629 Nullable value type may be null.
}
Value type is never ◼ Why these ones are not named using It is well known that for Polemic can be that > int? i;
> i.Value
System.InvalidOperationException: Nullable object must have a value.
+ System.ThrowHelper.ThrowInvalidOperationException(System.ExceptionResource)
+ Nullable<T>.get_Value() ◼ If these ones (that 4 ones) uses |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
No, it is not. See #4964. |
Beta Was this translation helpful? Give feedback.
No, it is not. See #4964.