Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omnisharp not working in VS Code online (code spaces) for standard dotnet web api application. #3913

Closed
hansenms opened this issue Jul 15, 2020 · 11 comments

Comments

@hansenms
Copy link

Issue Description

In VS Code online (codespaces), Omnisharp seems to not work anymore. It doesn't find any of the system libraries, etc:

image

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

  1. Create a new VS code online (codespaces) instance with the standard image.
  2. Create a new web api with dotnet new webapi
  3. Install C# extensions
  4. 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)
info: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
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"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
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'
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
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
info: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in '/home/codespace/workspace'.
info: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
info: OmniSharp.MSBuild.ProjectSystem
No solution files found in '/home/codespace/workspace'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/codespace/workspace/TestApi/TestApi.csproj'
info: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/home/codespace/workspace'.
info: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
info: OmniSharp.MSBuild.ProjectManager
Loading project: /home/codespace/workspace/TestApi/TestApi.csproj
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.WorkspaceInitializer
Configuration finished.
info: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/home/codespace/workspace' on host 1783.
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/home/codespace/workspace/TestApi/TestApi.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project '/home/codespace/workspace/TestApi/TestApi.csproj'
info: OmniSharp.MSBuild.ProjectManager
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 mono
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.202 Commit: 6ea70c8dca

Runtime 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
@JoeRobich
Copy link
Member

@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.

@aaronpowell
Copy link

@JoeRobich I think this is only somewhat new (like, last week or so) as I had had it working recently but it's just stopped. Unsure if there was an omnisharp or codespaces release in that timeframe that could be a point of investigation.

@juanc5ibanez
Copy link

juanc5ibanez commented Jul 21, 2020

Hi. I have this issue as well and going to C# Extension: 1.22.0 did not help. looks like the change would be in codespaces.

@tr909jester
Copy link

Hi all,

I have a quite similar problem (but on Mac OS) and filed it at nuget, which may not be the best place it seems...
https://github.com/NuGet/docs.microsoft.com-nuget/issues/2102

image

Cheers,
Daniel

@Stewartarmbrecht
Copy link

Just created a new default code space. Connected via the browser. Ran the following commands:

dotnet new sln
dotnet new web
dotnet sln add workspace.csproj
dotnet restore
dotnet build

Restore and build work. IDE looks like this:
image

@JoeRobich
Copy link
Member

JoeRobich commented Jul 23, 2020

Currently looking into this. The issue is that, during the design time build, MSBuild is not resolving Framework references in a way that our project system expects.

This is potentially an issue with the specific version of the SDK installed in the default environment.

@Stewartarmbrecht
Copy link

Is there a work around? Can we just update SDK to fix the issue?

@tr909jester
Copy link

Hi all,
see here for the solution that worked for me: #3314 (comment)
Uninstalled Mono that was installed by brew. Installed Mono from the official website => No problems any more!

@JoeRobich
Copy link
Member

As a workaround you can enter the following into the VS Code terminal:

sudo apt install -y dotnet-sdk-3.1
rm -rf /home/codespace/.dotnet

At this point if you type dotnet --info into the terminal it will be unable to find dotnet.

Kill the terminal by clicking the trash can.
image

ctrl+~ (or cmd+~) to reopen the terminal.

Enter dotnet --info and you should have the 3.1.301 sdk installed.

Restart OmniSharp by pressing ctrl+p (or cmd+p) and entering >Restart Omnisharp.
image

OmniSharp should restart and missing type errors should be gone.

@JoeRobich
Copy link
Member

I have opened an issue against the dev-containers - see microsoft/vscode-dev-containers#428

This issue seems to be that the .App.Ref packs are missing.

Installed on the default codespaces image:
image

Delivered in the Linux binaries tar.gz:
image

I have verified that adding only these missing pack folders fixes the issue with project loading in the C# extension.

@JoeRobich
Copy link
Member

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 #3913 (comment) to install a working SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants