vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

C# 11 required members syntax is not supported

Open Shayan-To opened this issue 3 years ago • 0 comments

Issue Description

I'm targeting net7.0 and trying to use required members. The project builds and runs correctly, but the C# extension is giving me syntax errors.

(I have set omnisharp.dotnetPath to my dotnet 7 installation path, and the dotnet command available from path is dotnet 7.)

Steps to Reproduce

Create a new empty dotnet 7 project, and add this:

public record TestClass
{
    public required string TestProp { get; init; }
}

Expected Behavior

No errors are shown, and everything is fine.

Actual Behavior

The required keyword gives this error: The name 'required' does not exist in the current context.

Logs

OmniSharp log

Starting OmniSharp server at 9/23/2022, 1:52:47 PM
    Target: /home/me/Test/Test-Project

OmniSharp server started with .NET 7.0.100-rc.1.22431.12
.
    Path: /home/me/.vscode/extensions/ms-dotnettools.csharp-1.25.0-linux-x64/.omnisharp/1.39.0-net6.0/OmniSharp.dll
    PID: 36530

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Unknown 0.0 (Unknown)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to /home/me/dotnet/dotnet-sdk-7.0.100-rc.1.22431.12-linux-x64/dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: .NET Core SDK 7.0.100 17.4.0 - "/home/me/dotnet/dotnet-sdk-7.0.100-rc.1.22431.12-linux-x64/sdk/7.0.100-rc.1.22431.12/"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: .NET Core SDK 7.0.100 17.4.0 - "/home/me/dotnet/dotnet-sdk-7.0.100-rc.1.22431.12-linux-x64/sdk/7.0.100-rc.1.22431.12/"
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in '/home/me/Test/Test-Project'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/me/Test/Test-Project/Test-Project.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/me/Test/Test-Project'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/me/Test/Test-Project' on host 36403.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/me/Test/Test-Project/Test-Project.csproj
[info]: OmniSharp.OmniSharpWorkspace
        Miscellaneous file: /home/me/Test/Test-Project/TestClass.cs added to workspace
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/me/Test/Test-Project/Test-Project.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/me/Test/Test-Project/Test-Project.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Test-Project
[info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers
        Solution initialized -> queue all documents for code analysis. Initial document count: 6.
Received response for /v2/getcodeactions but could not find request.
Received response for /v2/getcodeactions but could not find request.
[warn]: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService
        No symbol found. File: /home/me/Test/Test-Project/TestClass.cs, Line: 10, Column: 15.
Received response for /quickinfo but could not find request.
Received response for /quickinfo but could not find request.
Received response for /v2/getcodeactions but could not find request.
[warn]: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService
        No symbol found. File: /home/me/Test/Test-Project/Program.cs, Line: 31, Column: 11.
Received response for /quickinfo but could not find request.
Received response for /v2/getcodeactions but could not find request.
Received response for /completion/resolve but could not find request.
Received response for /v2/getcodeactions but could not find request.
Received response for /v2/getcodeactions but could not find request.
Received response for /quickinfo but could not find request.
Received response for /v2/getcodeactions but could not find request.
Received response for /v2/getcodeactions but could not find request.

C# log

EMPTY

Environment information

VSCode version: 1.71.2 C# Extension: 1.25.0

Mono Information OmniSharp using mono :6.12.0
Dotnet Information .NET SDK (reflecting any global.json): Version: 6.0.401 Commit: 0906eae6f8

Runtime Environment: OS Name: ubuntu OS Version: 20.04 OS Platform: Linux RID: ubuntu.20.04-x64 Base Path: /usr/share/dotnet/sdk/6.0.401/

global.json file: Not found

Host: Version: 6.0.9 Architecture: x64 Commit: 163a63591c

.NET SDKs installed: 6.0.401 [/usr/share/dotnet/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Download .NET: https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs: https://aka.ms/dotnet/runtimes-sdk-info

Visual Studio Code Extensions
Extension Author Version
code-spell-checker streetsidesoftware 2.7.0
codeforcesbot-ext avi01 1.0.6
console-tree-language undefined_publisher 1.1.0
csharp ms-dotnettools 1.25.0
EditorConfig EditorConfig 0.16.4
func-vscode tonwhales 0.2.2
gitlens eamodio 12.1.1
hexeditor ms-vscode 1.9.8
json-to-ts MariusAlchimavicius 1.7.5
jupyter ms-toolsai 2022.3.1000901801
jupyter-keymap ms-toolsai 1.0.0
jupyter-renderers ms-toolsai 1.0.6
markdown-all-in-one yzhang 3.4.0
mongodb-vscode mongodb 0.9.2
powershell ms-vscode 2021.12.0
prettier-vscode esbenp 9.8.0
prisma Prisma 3.13.0
python ms-python 2022.4.1
quicktype quicktype 12.0.46
rust-analyzer matklad 0.3.1014
selected-lines-count gurumukhi 1.4.0
systemd-unit-file coolbear 1.0.6
template-string-converter meganrogge 0.6.0
type-language pinealctx 0.0.3
vscode-codeforces KaustubhSathe 0.0.1
vscode-gutter-preview kisstkondoros 0.30.0
vscode-icons vscode-icons-team 11.11.0
vscode-paste-image mushan 1.0.4
vscode-peacock johnpapa 4.0.1
vscode-pylance ms-python 2022.4.1
vscode-sassdoc rafikis75 1.0.3
vscode-xml redhat 0.20.0
vscode-yaml redhat 1.6.0
vscode-zipfs arcanis 3.0.0

Shayan-To avatar Sep 23 '22 11:09 Shayan-To