0

In debug mode, Visual Studio recommended the following syntax change for null coalescing but then complains that this syntax requires at least C# 8.0.

Error message

However this is a dotnet 5.0 project specifically targeting C#9.0 on a supported VS2019 build:

Project

enter image description here

VS2019 VERSIO

So it seems like something is being cached to make this an issue but the basics (clean solution, reboot, vs update, etc) don't seem to clear the issue. Weirdly it works fine in release mode. How to shake this error out?

rism
  • 11,932
  • 16
  • 76
  • 116
  • Add LangVersion under the PropertyGroup node. Change the csproj file content to pin the language version used, sometimes there may not be a LangVerison node in this file. – Housheng-MSFT Sep 28 '22 at 06:55
  • I'm not sure what you are suggesting here? The question shows that `LangVersion` is already being explicitly set in a property group. Pulling that out and putting it in it's own property group doesn't alter the outcome. Can you elaborate? – rism Oct 27 '22 at 22:17

0 Answers0