The C# 8/.NET Framework combination is not officially supported by Microsoft. It is, they say, for experts only.

More on this:

After playing around with C# 8 for a while, I would definitely say, nullable reference types are awesome! The compiler analyzes the flow of your code to see if a null value could make it to where you use it. It did catch my silly copy-pasted-and-then-forgot-to-edit bugs! Thanks!

Make sure to check the C# 8.0 Feature Compatibility table from Stuart Lang’s post as well:

Look at that. Support Category = 1 is Syntax Only — Language features that are purely syntax will just work!

Let’s prove it by adding Directory.Build.props file in the root directory so that every .csproj (project file) in the solution will inherit the settings:

<?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <LangVersion>latest</LangVersion> <Nullable>enable</Nullable> </PropertyGroup> </Project>

and then write this crazy method.