dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.83k stars 654 forks source link

Error: Request /v2/getcodeactions cancelled, id: undefined #4881

Open Wanchai opened 2 years ago

Wanchai commented 2 years ago

Environment data

dotnet --info output:

Click to expand! ``` SDK .NET (reflétant tous les fichiers global.json) : Version: 5.0.402 Commit: e9d3381880 Environnement d'exécution : OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.402\ Host (useful for support): Version: 5.0.11 Commit: f431858f8b ```

VS Code version: 1.62.0 C# Extension version: v1.23.16

OmniSharp log

Click to expand! ``` Starting OmniSharp server at 09/11/2021, 12:15:56 Target: c:\repos\backend\src\XXX.Platform.sln OmniSharp server started. Path: c:\Users\XXX\.vscode\extensions\ms-dotnettools.csharp-1.23.16\.omnisharp\1.37.16\OmniSharp.exe PID: 16356 [info]: OmniSharp.Stdio.Host Starting OmniSharp on Windows 6.2.9200.0 (x64) [info]: OmniSharp.Services.DotNetCliService Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK [info]: OmniSharp.Services.DotNetCliService Using the 'dotnet' on the PATH. [info]: OmniSharp.Services.DotNetCliService DotNetPath set to dotnet [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Located 2 MSBuild instance(s) 1: Visual Studio Community 2019 16.11.31729.503 16.11.1 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" 2: StandAlone 17.0.0 - "c:\Users\XXX\.vscode\extensions\ms-dotnettools.csharp-1.23.16\.omnisharp\1.37.16\.msbuild\Current\Bin" [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Registered MSBuild instance: Visual Studio Community 2019 16.11.31729.503 16.11.1 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140 [info]: OmniSharp.Cake.CakeProjectSystem Detecting Cake files in 'c:\repos\backend\src'. [info]: OmniSharp.Cake.CakeProjectSystem Could not find any Cake files [info]: OmniSharp.MSBuild.ProjectSystem Detecting projects in 'c:\repos\backend\src\XXX.Platform.sln'. [info]: OmniSharp.MSBuild.ProjectManager Queue project update for 'c:\repos\backend\src\XXX\Web.Bff.XXX\Web.XXX.HttpAggregator\Web.XXX.HttpAggregator.csproj' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for 'c:\repos\backend\src\Core\EventBus\XXX.Core.EventBus\XXX.Core.EventBus.csproj' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for 'c:\repos\backend\src\Core\Services\XXX.Core.Services.Application\XXX.Core.Services.Application.csproj' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for 'c:\repos\backend\src\Core\Services\XXX.Core.Services.Application.Settings\XXX.Core.Services.Application.Settings.csproj' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for 'c:\repos\backend\src\Core\Services\XXX.Core.Services.Domain\XXX.Core.Services.Domain.csproj' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for 'c:\repos\backend\src\Core\WebHost\WebHost.Customization\WebHost.Customization.csproj' ... [info]: OmniSharp.Script.ScriptProjectSystem Detecting CSX files in 'c:\repos\backend\src'. [info]: OmniSharp.Script.ScriptProjectSystem Could not find any CSX files [info]: OmniSharp.WorkspaceInitializer Configuration finished. [info]: OmniSharp.Stdio.Host Omnisharp server running using Stdio at location 'c:\repos\backend\src' on host 1064. [info]: OmniSharp.MSBuild.ProjectManager Loading project: c:\repos\backend\src\XXX\Web.Bff.XXX\Web.XXX.HttpAggregator\Web.XXX.HttpAggregator.csproj ```

Steps to reproduce

When I try to use C# on VScode, omnisharp does not work.

Everything seems to work fine (install, setup and everything) but when I roll over some C# code, I get "[error] Problem invoking 'GetCodeActions' on OmniSharp server: Error: Request /v2/getcodeactions cancelled, id: undefined" from the extension host Log.

Also, when I try to install a previous version, I got a 404.

It's a new company PC and there's many blocking stuffs on it (anti-virus, VPN ...) but so far I managed to go around them. And now, this is a huge roadblock.

PS: I tried to re install VS code and also tried VS code in portable mode but it's exactly the same.

JoeRobich commented 2 years ago

@Wanchai Do you also see a list of code actions or do you only see the message in the log?

Wanchai commented 2 years ago

@JoeRobich Hi thank you for your answer.

It's solved and I don't know why... I still have those messages in the log btw.

The only thing I have changed is I have VS code 1.62.3 now.

This is all I see in the log:

[2021-11-24 17:10:50.486] [exthost] [error] [ms-dotnettools.csharp] provider FAILED
[2021-11-24 17:10:50.486] [exthost] [error] Problem invoking 'GetCodeActions' on OmniSharp server: Error: Request /v2/getcodeactions cancelled, id: undefined
[2021-11-24 17:11:00.393] [exthost] [error] [ms-dotnettools.csharp] provider FAILED
[2021-11-24 17:11:00.393] [exthost] [error] Problem invoking 'GetCodeActions' on OmniSharp server: Error: Request /v2/getcodeactions cancelled, id: undefined
[2021-11-24 17:11:01.846] [exthost] [error] [ms-dotnettools.csharp] provider FAILED
[2021-11-24 17:11:01.846] [exthost] [error] Problem invoking 'GetCodeActions' on OmniSharp server: Error: Request /v2/getcodeactions cancelled, id: undefined

That's it. After that, it seems to find it's way and work fine...

kentahikaru commented 2 years ago

Hello, i have the same problem.


my vs-code: Version: 1.67.0 Commit: 57fd6d0195bb9b9d1b49f6da5db789060795de47 Date: 2022-05-04T12:08:42.978Z Electron: 17.4.1 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.13-electron.0 OS: Linux x64 5.17.5-arch1-1

C# exension: Name: C# Id: ms-dotnettools.csharp Description: C# for Visual Studio Code (powered by OmniSharp). Version: 1.24.4 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp

dotnet --info .NET SDK (reflecting any global.json): Version: 6.0.102 Commit: 49861cb924

Runtime Environment: OS Name: arch OS Version:
OS Platform: Linux RID: arch-x64 Base Path: /usr/share/dotnet/sdk/6.0.102/

Host (useful for support): Version: 6.0.2 Commit: 839cdfb0ec

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

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


In Log(Extension Host) i see: [exthost] [warning] DiagnosticCollection with name 'csharp' does already exist. [exthost] [error] [ms-dotnettools.csharp] provider FAILED [exthost] [error] Problem invoking 'GetCodeActions' on OmniSharp server: Error: Request /v2/getcodeactions cancelled, id: undefined [exthost] [error] [ms-dotnettools.csharp] provider FAILED [exthost] [error] Problem invoking 'GetCodeActions' on OmniSharp server: Error: Request /v2/getcodeactions cancelled, id: undefined

I'm also getting this pop-up: Error loading webview: Error: Could not register service workers: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state..


Playing with other parts of my code, i got following "combination"

Log (Extension Host): [exthost] [warning] DiagnosticCollection with name 'csharp' does already exist. [exthost] [error] [ms-dotnettools.csharp] provider FAILED [exthost] [error] Problem invoking 'GetCodeActions' on OmniSharp server: Error: Request /v2/getcodeactions cancelled, id: 54

OmniSharp Log: (repeated many times)

    Creating instance of code fix provider 'Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.UriParametersShouldNotBeStringsFixer' failed, error: System.InvalidOperationException: Failed to create instrance of Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.UriParametersShouldNotBeStringsFixer in Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.UriParametersShouldNotBeStringsFixer, Microsoft.CodeAnalysis.NetAnalyzers, Version=6.0.5.1905, Culture=neutral, PublicKeyToken=31bf3856ad364e35. ---> System.TypeLoadException: Type Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.UriParametersShouldNotBeStringsFixer has invalid vtable method slot 7 with method none

at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00029] in <533173d24dae460899d2b10975534bb0>:0 at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic, System.Boolean wrapExceptions) [0x00095] in <533173d24dae460899d2b10975534bb0>:0 at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean wrapExceptions, System.Boolean skipCheckThis, System.Boolean fillCache) [0x00009] in <533173d24dae460899d2b10975534bb0>:0 at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Boolean wrapExceptions, System.Threading.StackCrawlMark& stackMark) [0x00027] in <533173d24dae460899d2b10975534bb0>:0 at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic, System.Boolean wrapExceptions) [0x00020] in <533173d24dae460899d2b10975534bb0>:0 at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <533173d24dae460899d2b10975534bb0>:0 at System.Activator.CreateInstance (System.Type type) [0x00000] in <533173d24dae460899d2b10975534bb0>:0 at OmniSharp.Utilities.ReflectionExtensions.CreateInstance[T] (System.Type type) [0x0001f] in <9ece9ed34d854f58a5f6cc935570c340>:0 --- End of inner exception stack trace --- at OmniSharp.Utilities.ReflectionExtensions.CreateInstance[T] (System.Type type) [0x00069] in <9ece9ed34d854f58a5f6cc935570c340>:0 at OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects+<>c__DisplayClass6_0.b__2 (System.Reflection.TypeInfo x) [0x000a2] in <4d68915e1fe448ed939a510ee373a3ec>:0 Received response for /v2/getcodeactions but could not find request.