question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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)
    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 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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JoeRobichcommented, Jul 15, 2020

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

0reactions
JoeRobichcommented, Jul 30, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# programming with Visual Studio Code
Our focus with VS Code is to be a great editor for cross-platform C# development. C# language within VS Code. VS Code supports...
Read more >
Intellisense not working in VSCode - OmniSharp Error
Go into VS code Preferences · Search for omnisharp. · Add/edit line "omnisharp. · Go back into settings and search omnisharp, scroll down...
Read more >
OmniSharp - Making cross-platform .NET a reality, and a ...
Here is an ASP.NET MVC app running in Sublime. The Sublime OmniSharp package output can be seen in the debug console there (Ctrl+~...
Read more >
Workaround for Omnisharp not downloading in VS Code issue
I have been using VSCode + C# Extension + Omnisharp for quite sometime on my MAC to learn dotnet core development.
Read more >
Dixin's Blog - C# 8.0 in-depth: Setup C# 8.0 and .NET Core 3.0
NET Core 3.0, with a lot of new features and new APIs. ... Now Visual Studio Code should work with dotnet CLI, since...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found