3

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.

Eric
  • 2,797
  • 2
  • 20
  • 19
  • 5
    No, it's not a bug. Parameter null checking has been [removed](https://devblogs.microsoft.com/dotnet/csharp-11-preview-updates/#remove-parameter-null-checking-from-c-11). It's uncommon for a preview feature to be completely removed (as opposed to just being postponed for one more language version) but it happens. – Jeroen Mostert Jun 16 '22 at 12:42
  • 2
    Eww, I liked it. Ty! Microsoft and the word support always confuses people. Why doesn't it say the feature is removed??? – Eric Jun 16 '22 at 12:50
  • Thats the thing about preview features, if you use them, the onus is on you to keep up to date with them and check for breaking changes between builds. If the feature was removed from a release build, then yes they would normally put that level of effort into error messages. – Chris Schaller Aug 16 '22 at 12:06

0 Answers0