What does "Enable nullability analysis when C# 8 compiler nullable warnings are enabled" do?

Under Resharper Options | Code Inspection | Settings there is an option: "Enable nullability analysis when C# 8 compiler nullable warnings are enabled".

What does this actually do, and in what circumstances would you want to turn it on or off?

1
5 comments

Hello, I have been having issues regarding Resharper's handling of C#8.0 nullable reference type feature.  (BTW, I visited the link you provided above but I keep getting a 503).

  1.  I have Nullable enabled through a Directory.Build.props file rather than in each csproj.  Resharper still believes I don't have it enabled when I do.
  2.  Anytime I try to mark a type with "?", resharper keeps changing my "?" to [CanBeNull].  I prefer to use built-in "?

I like annotations but why would I or anyone else need to add a designtime dependency to our code just for [CanBeNull] when its a feature built-in to the language?  [CanBeNull] was great before C#8 nullable reference types.  

I have played around with a lot of the settings and just cannot get it to cooperate.  I have been too busy to figure out the cause.  Suggestions?  I am using Resharper Ultimate version 2020.1.3 in both Visual Studio preview and Pro.

 

 

0

Hello Jason,

 

Currenty, ReSharper doesn't support properties specified in Directory.Build.props file, please refer to the following request -

https://youtrack.jetbrains.com/issue/RSRP-470254

As for changing nullable reference types [CanBeNull] annotation, could you please provide some code screenshot demonstrating the specified behavior?

Thank you.

0

Hello Jason,

 

Concerning changing nullable reference type to [CanBeNull] annotation, please disable typing assist for this case by unchecking ReSharper | Options | Editor | Behavior | C# | Annotate nullability on '!'/'?' after type name.

Hope it helps.

Thank you.

1

Hello Jason,

 

One note about support of properties specified in Directory.Build.props file. ReSharper should support such properties - https://youtrack.jetbrains.com/issue/RSRP-480672#focus=Comments-27-4317354.0-0

Could you please

* make sure that the following option is enabled - ReSharper | Options | Environment | General | Read solution model directly

* try clearing caches and reopen solution.

Please let me know if it helps.

Thank you.

 

0

Please sign in to leave a comment.