dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 670 forks source link

Extension Won't Load -- ms-dotnettools.csharp : Timed out while searching for 'workspaceContains' #4959

Open davidvmckay opened 2 years ago

davidvmckay commented 2 years ago

p.s., cannot use the extension to "prefill this information" because the issue I wish to report is that the extension won't load:

When I try to use the "prefill" command, the Error I see is Command 'CSharp: Report an issue' resulted in an error (command 'csharp.reportIssue' not found)

To prefill this information:
  1. Open Visual Studio Code
  2. Bring up the command palette (press F1)
  3. Type CSharp: Report an issue
    • If the CSharp: Report an issue command doesn't appear, make sure that you have C# extension version 1.17.0 or newer installed.

synopsis

After vscode update to 1.63, the c# extension (ms-dotnettools.csharp, a.k.a omnisharp-vscode) refuses to load. Based on logs from the Extension Host, this seems to stem from a change in vscode 1.63 meant to avoid hangs when loading unresponsive extensions: https://code.visualstudio.com/updates/v1_63#_timeout-of-workspacecontains

additional context

Log (Extension Host)

[2021-12-15 12:56:36.709] [exthost] [info] Extension host with pid 35272 started
[2021-12-15 12:56:36.709] [exthost] [info] Skipping acquiring lock for /Users/davidvmckay/Library/Application Support/Code/User/workspaceStorage/69cc67dd67e363a4c7eca9ee4cdaa7df.
[2021-12-15 12:56:38.138] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
[2021-12-15 12:56:38.146] [exthost] [info] ExtensionService#_doActivateExtension eamodio.gitlens, startup: false, activationEvent: 'onFileSystem:gitlens'
[2021-12-15 12:56:38.179] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.181] [exthost] [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.github
[2021-12-15 12:56:38.188] [exthost] [info] ExtensionService#_doActivateExtension 2gua.rainbow-brackets, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.191] [exthost] [info] ExtensionService#_doActivateExtension cliffordfajardo.highlight-line-vscode, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.193] [exthost] [info] ExtensionService#_doActivateExtension CoenraadS.disableligatures, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.195] [exthost] [info] ExtensionService#_doActivateExtension IgorSbitnev.error-gutters, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.200] [exthost] [info] ExtensionService#_doActivateExtension imagio.vscode-dimmer-block, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.204] [exthost] [info] ExtensionService#_doActivateExtension kisstkondoros.vscode-gutter-preview, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.261] [exthost] [info] ExtensionService#_doActivateExtension lihui.vs-color-picker, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.264] [exthost] [info] ExtensionService#_doActivateExtension mhutchie.git-graph, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.310] [exthost] [info] ExtensionService#_doActivateExtension mtxr.sqltools, startup: true, activationEvent: '*', root cause: mtxr.sqltools-driver-pg
[2021-12-15 12:56:38.365] [exthost] [info] ExtensionService#_doActivateExtension oderwat.indent-rainbow, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.368] [exthost] [info] ExtensionService#_doActivateExtension SirTori.indenticator, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.369] [exthost] [info] ExtensionService#_doActivateExtension voldemortensen.rainbow-tags, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.370] [exthost] [info] ExtensionService#_doActivateExtension vscode-icons-team.vscode-icons, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.402] [exthost] [info] ExtensionService#_doActivateExtension yahya-gilany.vscode-clock, startup: true, activationEvent: '*'
[2021-12-15 12:56:38.412] [exthost] [info] ExtensionService#_doActivateExtension vscode.npm, startup: true, activationEvent: 'workspaceContains:package.json'
[2021-12-15 12:56:38.423] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.js-debug, startup: true, activationEvent: 'workspaceContains:node_modules/react-native', root cause: msjsdiag.vscode-react-native
[2021-12-15 12:56:39.002] [exthost] [info] ExtensionService#_doActivateExtension vscode.git, startup: false, activationEvent: 'api', root cause: eamodio.gitlens
[2021-12-15 12:56:39.314] [exthost] [info] ExtensionService#_doActivateExtension msjsdiag.vscode-react-native, startup: true, activationEvent: 'workspaceContains:node_modules/react-native'
[2021-12-15 12:56:44.701] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
[2021-12-15 12:56:45.108] [exthost] [info] Not activating extension 'ms-dotnettools.csharp': Timed out while searching for 'workspaceContains' pattern *.csproj,*.sln,*.slnf,*.csx,*.cake,**/*.csproj,**/*.sln,**/*.slnf,**/*.csx,**/*.cake
[2021-12-15 12:56:48.115] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onStartupFinished'
[2021-12-15 12:56:48.120] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
[2021-12-15 12:56:48.122] [exthost] [info] ExtensionService#_doActivateExtension alefragnani.separators, startup: false, activationEvent: 'onStartupFinished'
[2021-12-15 12:56:48.124] [exthost] [info] ExtensionService#_doActivateExtension dbaeumer.vscode-eslint, startup: false, activationEvent: 'onStartupFinished'
[2021-12-15 12:56:48.131] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-containers, startup: false, activationEvent: 'onStartupFinished'
[2021-12-15 12:56:48.156] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl, startup: false, activationEvent: 'onStartupFinished'
[2021-12-15 12:56:48.163] [exthost] [info] ExtensionService#_doActivateExtension PKief.material-icon-theme, startup: false, activationEvent: 'onStartupFinished'
[2021-12-15 12:56:48.173] [exthost] [info] ExtensionService#_doActivateExtension ryu1kn.partial-diff, startup: false, activationEvent: 'onStartupFinished'
[2021-12-15 12:56:48.179] [exthost] [info] ExtensionService#_doActivateExtension usernamehw.errorlens, startup: false, activationEvent: 'onStartupFinished'
[2021-12-15 12:58:42.920] [exthost] [info] ExtensionService#_doActivateExtension vscode.github, startup: false, activationEvent: '*'
[2021-12-15 12:58:42.930] [exthost] [info] ExtensionService#_doActivateExtension mtxr.sqltools-driver-pg, startup: false, activationEvent: '*'

Environment data

Wed Dec 15 12:57:16 EST 2021davidvmckay~/code ✔
λ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  12.1
 OS Platform: Darwin
 RID:         osx-x64
 Base Path:   /usr/local/share/dotnet/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  5.0.102 [/usr/local/share/dotnet/sdk]
  6.0.100-preview.6.21355.2 [/usr/local/share/dotnet/sdk]
  6.0.100 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-preview.6.21355.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

VS Code version:

Wed Dec 15 13:07:08 EST 2021davidvmckay~/code ✔
λ code --version
1.63.1
fe719cd3e5825bf14e14182fddeb88ee8daf044f
x64

C# Extension version:

v1.23.17

OmniSharp log

NO LOG - extension never loads

Steps to reproduce

  1. use ms-dotnettools.csharp v1.23.17 Visual Studio Code v1.62.3 for x64 macOS to open a workspace including with multiple folders each containing a .csproj and accompanying code files
    1. see that this works fine, analyzers, hover tips, autocomplete, and dependency navigation function as expected
  2. use the in-app Check for updates functionality to upgrade Visual Studio Code to v1.63
  3. see that the same workspace no longer exhibits any of the syntax-aware features provided by omnisharp (although syntax highlighting still works, it is likely not provided by the same language service)

Expected behavior

Continue to have functioning C# analyzers, hover tips, autocomplete, and dependency navigation.

Actual behavior

The omnisharp-vscode extension doesn't even load (Actually the extension is registered as ms-dotnettools.csharp)

davidvmckay commented 2 years ago

omnisharp-vscode v1.24.0-beta1 tried to simplify the glob for workspaceContains via omnisharp v1.38 (commit), but this was inadequate to overcome the 7-second timeout in my environment.

davidvmckay commented 2 years ago

One thing that helped was removing a lot of projects / folders from my workspace. This brought the glob time down under 7 seconds, and Omnisharp was able to load.

But now I need to create a whole bunch of other workspaces and switch between them frequently, so not ideal.

Another thing that helped was just using a faster computer - but clearly that is not a scalable solution.

erikrenaud commented 2 years ago

Yep - just realized the reason i didn't have language server for c# running was this particular issue:

[2022-08-17 11:31:57.203] [exthost] [info] Not activating extension 'Dart-Code.dart-code': Timed out while searching for 'workspaceContains' pattern /pubspec.yaml,//pubspec.yaml,.dart,/.dart,//*.dart [2022-08-17 11:31:57.203] [exthost] [info] Not activating extension 'fernandoescolar.vscode-solution-explorer': Timed out while searching for 'workspaceContains' pattern /.sln [2022-08-17 11:31:57.203] [exthost] [info] Not activating extension 'lokalise.i18n-ally': Timed out while searching for 'workspaceContains' pattern .vue [2022-08-17 11:31:57.203] [exthost] [info] Not activating extension 'ms-azuretools.vscode-azurefunctions': Timed out while searching for 'workspaceContains' pattern /host.json [2022-08-17 11:31:57.204] [exthost] [info] Not activating extension 'ms-dotnettools.csharp': Timed out while searching for 'workspaceContains' pattern /*.{csproj,sln,slnf,csx,cake} [2022-08-17 11:31:57.204] [exthost] [info] Not activating extension 'ms-mssql.sql-database-projects-vscode': Timed out while searching for 'workspaceContains' pattern */.sqlproj [2022-08-17 11:31:57.204] [exthost] [info] Not activating extension 'ms-playwright.playwright': Timed out while searching for 'workspaceContains' pattern /playwright.config.{ts,js,mjs}