Omnisharp does not start when ran from WSL / fedoraremix
Environment data
dotnet --info output:
.NET SDK (reflecting any global.json):
Version: 5.0.206
Commit: 0cf287db1b
Runtime Environment:
OS Name: fedoraremixforwsl
OS Version: 34
OS Platform: Linux
RID: fedora.34-x64
Base Path: /usr/lib64/dotnet/sdk/5.0.206/
Host (useful for support):
Version: 5.0.9
Commit: 208e377a53
.NET SDKs installed:
5.0.206 [/usr/lib64/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.9 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.9 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
VS Code version: 1.61.0
C# Extension version: v1.23.16
OmniSharp log
[2021-10-12 20:49:06.235] [exthost] [info] extension host started
[2021-10-12 20:49:06.255] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: true, activationEvent: '*'
[2021-10-12 20:49:06.255] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/marcin/.vscode-server/bin/ee8c7def80afc00dd6e593ef12f37756d8f504ea/extensions/debug-auto-launch/dist/extension
[2021-10-12 20:49:06.258] [exthost] [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*', root cause: vscode.github
[2021-10-12 20:49:06.258] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/marcin/.vscode-server/bin/ee8c7def80afc00dd6e593ef12f37756d8f504ea/extensions/git/dist/main
[2021-10-12 20:49:06.302] [exthost] [info] Lock '/home/marcin/.vscode-server/data/User/workspaceStorage/2c8fb4a91ec52caf278ca648ccffa1aa/vscode.lock': Lock acquired.
[2021-10-12 20:49:06.461] [exthost] [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
[2021-10-12 20:49:06.461] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/marcin/.vscode-server/bin/ee8c7def80afc00dd6e593ef12f37756d8f504ea/extensions/github/dist/extension.js
[2021-10-12 20:49:06.507] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onStartupFinished'
[2021-10-12 20:49:06.507] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/marcin/.vscode-server/bin/ee8c7def80afc00dd6e593ef12f37756d8f504ea/extensions/emmet/dist/node/emmetNodeMain
[2021-10-12 20:49:06.518] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
[2021-10-12 20:49:06.518] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/marcin/.vscode-server/bin/ee8c7def80afc00dd6e593ef12f37756d8f504ea/extensions/merge-conflict/dist/mergeConflictMain
[2021-10-12 20:49:06.521] [exthost] [info] eager extensions activated
[2021-10-12 20:49:06.540] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.js-debug, startup: false, activationEvent: 'onCommand:extension.js-debug.clearAutoAttachVariables'
[2021-10-12 20:49:06.540] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/marcin/.vscode-server/bin/ee8c7def80afc00dd6e593ef12f37756d8f504ea/extensions/ms-vscode.js-debug/src/extension.js
[2021-10-12 20:49:41.891] [exthost] [info] ExtensionService#_doActivateExtension vscode.configuration-editing, startup: false, activationEvent: 'onLanguage:json'
[2021-10-12 20:49:41.891] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/marcin/.vscode-server/bin/ee8c7def80afc00dd6e593ef12f37756d8f504ea/extensions/configuration-editing/dist/configurationEditingMain
[2021-10-12 20:49:41.894] [exthost] [info] ExtensionService#_doActivateExtension vscode.extension-editing, startup: false, activationEvent: 'onLanguage:json'
[2021-10-12 20:49:41.894] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/marcin/.vscode-server/bin/ee8c7def80afc00dd6e593ef12f37756d8f504ea/extensions/extension-editing/dist/extensionEditingMain
[2021-10-12 20:49:41.905] [exthost] [info] ExtensionService#_doActivateExtension vscode.json-language-features, startup: false, activationEvent: 'onLanguage:json'
[2021-10-12 20:49:41.905] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/marcin/.vscode-server/bin/ee8c7def80afc00dd6e593ef12f37756d8f504ea/extensions/json-language-features/client/dist/node/jsonClientMain
[2021-10-12 20:49:41.945] [exthost] [info] ExtensionService#_doActivateExtension vscode.npm, startup: false, activationEvent: 'onLanguage:json'
[2021-10-12 20:49:41.945] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/marcin/.vscode-server/bin/ee8c7def80afc00dd6e593ef12f37756d8f504ea/extensions/npm/dist/npmMain
[2021-10-12 20:49:44.945] [exthost] [info] ExtensionService#_doActivateExtension ms-dotnettools.csharp, startup: false, activationEvent: 'workspaceContains:project.json,*.csproj,*.sln,*.slnf,*.csx,*.cake,**/*.csproj,**/*.sln,**/*.slnf,**/*.csx,**/*.cake'
[2021-10-12 20:49:44.945] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/marcin/.vscode-server/extensions/ms-dotnettools.csharp-1.23.16/dist/extension
[2021-10-12 20:49:45.065] [exthost] [error] Activating extension ms-dotnettools.csharp failed due to an error:
[2021-10-12 20:49:45.065] [exthost] [error] TypeError: Cannot read property 'isWindows' of undefined
at /home/marcin/.vscode-server/extensions/ms-dotnettools.csharp-1.23.16/dist/extension.js:2:672818
at Generator.throw (<anonymous>)
at a (/home/marcin/.vscode-server/extensions/ms-dotnettools.csharp-1.23.16/dist/extension.js:2:670153)
Steps to reproduce
- I'm running WSLv2 with latest
fedoraremix 34.5.6 Final(https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL) - I'm runnig VSCode from WSL
- I installed C# extension in WSL
Expected behavior
Omnisharp should initialize and provide intellisense.
Actual behavior
Omnisharp does not initialize, and there's the Cannot read property 'isWindows' of undefined error in the log. Seems like Omnisharp is unable to identify the platform when ran from fedoraremix. I'm seeing no such issued when I run the same steps with Ubuntu 20.04 LTS.
So, I did a little digging, and it seems this issue is related to this code fragment: https://github.com/OmniSharp/omnisharp-vscode/blob/5e48576134ef9b16226dcd9db400088f99e8a7de/src/common.ts#L95-L97
When the omnisharp first initializes, it opens a VS Code Terminal (which in this case runs my WSL Bash), and then observes stderr of that terminal, and fails if it sees anything it doesn't like in stderr. The thing is my .bashrc caused some messages to appear in stderr, but other than that it initialized properly.
When I commented out the quoted section, Omnisharp initialized properly.
I'll try to make by .bashrc and VSCode like each other again to prevent polluting stderr, but that logic in getUnixChildProcessIds is quite peculiar, and I wonder what purpose it serves?
I think you can reproduce this issue by echo'ing anything to stderr in your .bashrc and observing Omnisharp no longer initializes propely.
One of our users hit this in https://github.com/microsoft/vscode-docker/issues/3553
The original Unix/C semantics is that stdout is for program output and stderr is for diagnostic, human-consumption messages. We should NOT assume that presence of data in stderr implies error condition.