Omnisharp not working in VS Code online (code spaces) for standard dotnet web api application.
See original GitHub issueIssue Description
In VS Code online (codespaces), Omnisharp seems to not work anymore. It doesn’t find any of the system libraries, etc:
Lot’s of error messages like:
The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [TestApi, TestApi]
Steps to Reproduce
- Create a new VS code online (codespaces) instance with the standard image.
- Create a new web api with
dotnet new webapi
- Install C# extensions
- Open
.cs
file and look at the highlighting and errors.
Expected Behavior
Omnisharp and C# extensions should work out of the box.
Actual Behavior
As described above. Highlighting and intellisense does not appear to work.
Logs
OmniSharp log
Starting OmniSharp server at 7/15/2020, 4:14:17 PM Target: /home/codespace/workspace
OmniSharp server started. Path: /home/codespace/.vscode-remote/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/run PID: 1885
Starting OmniSharp on debian 9.0 (x64)
DotNetPath set to dotnet
Located 1 MSBuild instance(s)
1: StandAlone 16.4 - "/home/codespace/.vscode-remote/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin"
MSBUILD_EXE_PATH environment variable set to '/home/codespace/.vscode-remote/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
Registered MSBuild instance: StandAlone 16.4 - "/home/codespace/.vscode-remote/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /home/codespace/.vscode-remote/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin
CscToolPath = /home/codespace/.vscode-remote/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /home/codespace/.vscode-remote/extensions/ms-dotnettools.csharp-1.22.1/.omnisharp/1.35.3/omnisharp/.msbuild
Detecting Cake files in '/home/codespace/workspace'.
Could not find any Cake files
No solution files found in '/home/codespace/workspace'
Queue project update for '/home/codespace/workspace/TestApi/TestApi.csproj'
Detecting CSX files in '/home/codespace/workspace'.
Could not find any CSX files
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
Loading project: /home/codespace/workspace/TestApi/TestApi.csproj
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
Configuration finished.
Omnisharp server running using Stdio at location '/home/codespace/workspace' on host 1783.
Successfully loaded project file '/home/codespace/workspace/TestApi/TestApi.csproj'.
Adding project '/home/codespace/workspace/TestApi/TestApi.csproj'
Update project: TestApi
C# log
It is empty
Environment information
VSCode version: 1.45.1 C# Extension: 1.22.1
Mono Information
OmniSharp using built-in monoDotnet Information
.NET Core SDK (reflecting any global.json): Version: 3.1.202 Commit: 6ea70c8dcaRuntime Environment: OS Name: debian OS Version: 9 OS Platform: Linux RID: debian.9-x64 Base Path: /opt/dotnet/sdks/3.1.202/sdk/3.1.202/
Host (useful for support): Version: 3.1.4 Commit: 0c2e69caa6
.NET Core SDKs installed: 1.1.14 [/home/codespace/.dotnet/sdk] 2.1.806 [/home/codespace/.dotnet/sdk] 2.2.402 [/home/codespace/.dotnet/sdk] 3.0.103 [/home/codespace/.dotnet/sdk] 3.1.202 [/home/codespace/.dotnet/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.2.7 [/home/codespace/.dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.7 [/home/codespace/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.3 [/home/codespace/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.4 [/home/codespace/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.1.13 [/home/codespace/.dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.7 [/home/codespace/.dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.3 [/home/codespace/.dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.4 [/home/codespace/.dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions
Extension | Author | Version |
---|---|---|
csharp | ms-dotnettools | 1.22.1 |
vscode-pull-request-github | GitHub | 0.16.0 |
vsonline | ms-vsonline | 1.0.2471 |
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
@hansenms Thanks for reporting this issue. I was able to reproduce it.
From the command line the project restores and builds fine. The design time build seems to be fine because the project loads and errors are reported. But it seems the sdk reference assemblies are not being added properly to the workspace. Will need some additional investigation to determine where the issue lies.
Closing this issue. Codespaces has updated to a newer version of the .dev-container used in the default codespaces environment with properly installed .net core SDK.
You will need to either delete and recreate your codespaces environment or follow the workaround in https://github.com/OmniSharp/omnisharp-vscode/issues/3913#issuecomment-663749636 to install a working SDK.