In my case, I ran into this problem with Visual Studio 2022 when I changed the target framework from .NET Standard 2.1 to .NET Standard 2.0. I solved my problem by removing <Nullable>enable</Nullable>
in the .csproj file and restarting Visual Studio.
Original .csproj file:
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
New .csproj file:
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>