NullabilityInference icon indicating copy to clipboard operation
NullabilityInference copied to clipboard

Reference assemblies lack annotations

Open dgrunwald opened this issue 4 years ago • 0 comments

Even on .NET Core 3.1, not all system libraries are annotated.

For example, the System.Linq methods are lacking annotations. This means a call like collection.FirstOrDefault() will:

  • incorrectly allow nullable collections
  • incorrectly allow the return value to be non-nullable

This can cause significantly wrong annotations being inferred (and then accepted by the compiler without warning).

Maybe we should somehow include the .NET 5 annotations with the inference tool, so that it can produce useful results on projects targeting .NET Core 3 or even .NET Framework 4.x?

dgrunwald avatar Jun 17 '20 18:06 dgrunwald