NullabilityInference
NullabilityInference copied to clipboard
Reference assemblies lack annotations
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?