dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.19k stars 9.93k forks source link

Visual Studio 16.8.0 doesn't recognize the new record type and possibly other C# 9 features #27713

Closed Arclight3 closed 3 years ago

Arclight3 commented 3 years ago

Describe the bug

Visual Studio 16.8.0 doesn't recognize records, top level programs and maybe other C# 9 features. The code compiles and runs correctly but the intellisense doesn't recognize the new syntax and highlights these features as errors.

Please see the attached screenshots: error1 error2

To Reproduce

  1. Create a new ASP.NET Core Web Application using the ASP.NET Core 5.0 target framework and the ASP.NET Core Web API template.
  2. Declare a record and instantiate it. Then print it to the Debug Console.
  3. Observe the result: The code compiles and the record is printed, but Visual Studio intellisense reports the record declaration and usage as errors.

Further technical details

> dotnet --info

.NET SDK (reflecting any global.json):
Version:   5.0.100
Commit:    5044b93829

Runtime Environment:
OS Name:     Windows
OS Version:  10.0.18363
OS Platform: Windows
RID:         win10-x64
Base Path:   C:\Program Files\dotnet\sdk\5.0.100\

Host (useful for support):
  Version: 5.0.0
  Commit:  cf258a14b7

.NET SDKs installed:
  2.1.811 [C:\Program Files\dotnet\sdk]
  2.2.207 [C:\Program Files\dotnet\sdk]
  3.0.103 [C:\Program Files\dotnet\sdk]
  3.1.403 [C:\Program Files\dotnet\sdk]
  5.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
javiercn commented 3 years ago

@IustinMicu thanks for contacting us.

This is not an issue related to asp.net core. In order for you to get a better and faster response, we suggest you file the issue through the visual studio report a problem dialog.

andrzejkrolgc commented 3 years ago

@IustinMicu I had the same problems disabling ReSharper fixed them, dunno if you are using it but it might be helpful for someone else as well.

Arclight3 commented 3 years ago

Thanks @andrzejkrolgc ! I confirm that it works after disabling ReSharper. I hope this will be fixed soon then, because ReSharper is quite a productivity booster tool 😄