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 reloading references

See original GitHub issue

Issue Description

Every time I reference a new class and get the quick fixes I don’t get the option to add a “using namespace” statement to the file. Also when I reference a new class contained in a namespace that is already referenced I still get the error: The type or namespace name 'ClassName' could not be found (are you missing a using directive or an assembly reference?)

To fix it I have to manually restart Omnisharp

Some more context: I’m running VSCode on Docker containers

Steps to Reproduce

  1. Create a simple dotnet core application
  2. Create 2 class files in separate namespaces and reference one in the other

Expected Behavior

You should be able to get the option to add a Using statement when using the Quick Fix feature

Actual Behavior

Quick Fix feature not shown, unless Omnisharp is restarted

Logs

OmniSharp log

Starting OmniSharp server at 11/3/2020, 2:10:59 PM
    Target: /workspace

OmniSharp server started.
    Path: /root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/run
    PID: 1532

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on debian 10.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 16.8.0 - "/root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 16.8.0 - "/root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin"
            CscToolExe = csc.exe
            MSBuildToolsPath = /root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin
            CscToolPath = /root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/Roslyn
            BypassFrameworkInstallChecks = true
            MSBuildExtensionsPath = /root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/omnisharp/.msbuild
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/workspace'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in '/workspace'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/workspace/ContentEditor.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/workspace'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /workspace/ContentEditor.csproj
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
[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 '/workspace' on host 371.
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/workspace/ContentEditor.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/workspace/ContentEditor.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: ContentEditor

C# log

Installing C# dependencies...
Platform: linux, x86_64, name=debian, version=10

Downloading package 'OmniSharp for Linux (x64)' (47313 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package 'OmniSharp for Linux (x64)'

Downloading package '.NET Core Debugger (linux / x64)' (55714 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package '.NET Core Debugger (linux / x64)'

Downloading package 'Razor Language Server (Linux / x64)' (54208 KB).................... Done!
Installing package 'Razor Language Server (Linux / x64)'

Finished

Environment information

VSCode version: 1.50.1 C# Extension: 1.23.4

Mono Information OmniSharp using built-in mono
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.403 Commit: 9e895200cd

Runtime Environment: OS Name: debian OS Version: 10 OS Platform: Linux RID: debian.10-x64 Base Path: /usr/share/dotnet/sdk/3.1.403/

Host (useful for support): Version: 3.1.9 Commit: 774fc3d6a9

.NET Core SDKs installed: 3.1.403 [/usr/share/dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.9 [/usr/share/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.23.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
JoeRobichcommented, Nov 5, 2020
0reactions
ManfredLangecommented, Nov 21, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Omnisharp not loading properly - Visual Studio Code and Unity
This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution ...
Read more >
VSCode omnisharp not loading - Unity Answers
I am suddenly failing to get VS Code on Ubuntu to have omnisharp to initialize. I am getting the following error: [fail]: OmniSharp.MSBuild....
Read more >
visual studio code no longer referencing things - MSDN
i tried loading it in VS 2019 and it ran without an issue,because i was a little worried i has caused an error...
Read more >
Omnisharp not working with Mono and Unity on Gentoo
NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono ...
Read more >
omnisharp-vscode - Discover .NET
NET Framework builds of OmniSharp no longer ship with Mono or the MSBuild tooling (See announcement ... Removed nuget versioning reference from OmniSharp....
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