How to fix `error CS8989: The 'parameter null-checking' feature is not supported.`

Viewed 63

After installing .NET SDK 7.0.100-preview.5 and 6.0.301, I get a long list of this error:

error CS8989: The 'parameter null-checking' feature is not supported.

That is because I use the Parameter null-checking feature like this in a lot of places, since that worked when I had .NET SDK 7.0 Preview 4 installed:

void Method(Class argument!!) { }

However now making all of the following changes in succession, I cannot get rid of this error:

Project.csproj

<PropertyGroup>
    <EnablePreviewFeatures>true</EnablePreviewFeatures>
    <RequiresPreviewFeatures>true</RequiresPreviewFeatures>
    <LangVersion>preview</LangVersion>
    <TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

How do I fix this? Is this a bug?

EDIT: This is not a duplicate of CA1062 is thrown after updating to !! parameter null checking in the first place because that issue doesn't mention the error CS8989. Normal people get a compiler error (CS0000) and not a code analysis error. The latter is opt-in and has to be configured manually.

0 Answers
Related