Roslyn: Quick Info shouldn't show the null state of non-nullable value types or constants

Created on 11 Jul 2019  路  7Comments  路  Source: dotnet/roslyn

Version used: 3.3.0-beta1-19354-02

The IDE shows the null-state for this enum member, which doesn't really make sense to me because

  1. it's a non-nullable value type, and
  2. it's a constant, so I can already see in Quick Info that its constant value is non-null.

nullability-quick-info

Area-Compilers Area-IDE Bug IDE-IntelliSense New Language Feature - Nullable Semantic Model

All 7 comments

@jasonmalinowski, apparently rikki agrees with me :). /cc @ryzngard

This confused me too..
image

In particular I think the wording of "is not null here" makes it seem like it sayings it could be null elsewhere.

I agree too, and find this very confusing. If it must say something, "'x' can never be null" would be clearer, but I'd vote to remove it.

After discussion with @cston, I think the appropriate solution here is to standardize value types on a NullableAnnotation.NotApplicable and NullableFlowState.NotApplicable. You cannot have null value types that aren't Nullable.

Leaving @ryzngard assigned as I'm sure there will be some IDE work to react.

@ryzngard, after #34412 is fixed, the annotation from the public API for non-nullable value types will be NotAnnotated always, so value types will need to be special-cased in the IDE to avoid reporting "is not null here".

so value types will need to be special-cased in the IDE to avoid reporting "is not null here".

Note: please test nullable value types when you do this to make sure the experience makes sense.

Was this page helpful?
0 / 5 - 0 ratings