1

Two separate issues appearing; not sure if they're the same root cause or not so for now putting into one Question.

I'm trying to upgrade a project to C#8 and use the nullable reference types. So, in the .csproj, I put the following into every <PropertyGroup>...</PropertyGroup> group:

<LangVersion>8</LangVersion>
<Nullable>enable</Nullable>
<WarningsAsErrors>CS8600;CS8601;CS8602;CS8603;CS8604</WarningsAsErrors>

I then went through and replaced the ReSharper [CanBeNull]s will nullable types.

Now, when I compile, I get a bunch of error and warningss - CS8603, CS8601, CS8604, CS8614, etc.

My Error List is configured to show 'Build + Intellisense'. When I open a file by double-clicking one of these errors, for half a second t shows correctly, giving a red underline for the error - and then the error goes away (both from the Error List and from the underlining in the editor itself), and sometimes a CS8632 warning comes in its place. Changing the Error List to 'Build Only' will make the errors show correctly again, but only in the Error List - not in the editor's error highlighting.

So, my issues:

  1. How can I make the error highlighting not go away?
  2. How can I make CS8632 not show up? My understanding from this Question is that adding the <Nullable>enable</Nullable> to the .csproj should have done that.

I'm using VS2019 and the .csproj is a .NET Framework 4.7.2 Class Library, if that's relevant.

Sarov
  • 545
  • 6
  • 17

0 Answers0