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_
You should be able to get the option to add a Using statement when using the Quick Fix feature
Quick Fix feature not shown, unless Omnisharp is restarted
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
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
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|;
You are using version 1.23.4. 1.23.5 is even worse for me. It looks like new files are never added to the in memory workspace, while in previous releases new files were found most of the time after a little delay.
@333fred could #4141 or #4143 have something to do with this?
I am not running in a Docker context.
Likely, I can reproduce it locally. I'll take a look. Thanks for the tag @tverboon.
1.23.5 is even worse for me.
FWIW, I would very much expect .5 to be better than .4 here. I made a couple of bug fixes for .5, .4 will have very bad behavior if an external editor changes the file on disk.
Yeah, sorry, I couldn't find the right words. It wasn't meant to say this complete version is worse, but I just started a new library project, so I am adding a lof of new files at the moment 馃槃 .
I am following your work on Omnisharp and it's obvious you are really pushing this forward to give us a better experience. Thanks for that!
A fix is available in this pre-release build - https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.23.6-beta1. Instructions for installing our beta releases https://github.com/OmniSharp/omnisharp-vscode/wiki/Installing-Beta-Releases
A fix is available in this pre-release build - https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.23.6-beta1. Instructions for installing our beta releases https://github.com/OmniSharp/omnisharp-vscode/wiki/Installing-Beta-Releases
Here its not working yet... :(
https://github.com/OmniSharp/omnisharp-vscode/issues/4192#issuecomment-724980226
It sounds like the issue you're experience is unrelated Katekko.
@333fred I'm still experiencing the same issue. Not sure if it's related to vscode-server (i'm working inside a docker container).
I can reproduce simply by copying a .cs file. Omnisharp won't work on that new copied file.
Also I noticed that restarting omnisharp does not always fix the issue, but it seems that when that fails I can just reload the window and that will succeed in fixing the issue.
We haven't released 1.23.6 yet.
@333fred I can see it here https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v.1.23.6
And the C# version on vscode is 1.23.6
Am I missing something?
@JoeRobich did we release this yet? I didn't think we did.
@333fred We have.
@gionapaolini then can you please open a new bug with repro instructions?
Sure, I tried reproducing with a simple case using docker containers, but I wasn't able to reproduce.
I think it might have something to do either with Volumes or Kubernetes, since in my case I'm using both (development inside K8S).
I'll create a new ticket when I have more time to find the steps to reproduce.
In any case thanks for your work.
This issue has not been resolved with release 1.23.6 unfortunately. Here is an output from "Omnisharp Log" after creating a new file then typing in a namespace plus a new class plus a new method.
[info]: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionService
Could not find document for file /app/src/PiranhaNH.Tests/FooTests.cs
It's easy to reproduce:
netcoreappp3.1 or net5.0Code in a new file:
namespace Bar
{
[TestFixture]
public class FooTests
{
[Test]
public void Foobar()
{
}
}
}
The screenshot shows that no actions are available either to add the using statement / reference:

Saving the file makes no difference.
(Re-)building the project makes no difference.
Restarting omnisharp-vscode with "OmniSharp: Restart OmniSharp" solve the problem
Note, though, that on average I probably have to restart OmniSharp every 5 to 10 minutes. It's quite a significant impediment to working faster.
I'll probably file this as a separate issue, since this affects version 1.23.6
@ManfredLange can you try setting omnisharp.path to latest as well? We have another bug fix on the server-side that might fix it for you. If not, then please do open a new issue.
@333fred Thank you! I set omnisharp.path to latest as well. It then installed version 1.37.4-beta.61. However, that didn't change the behavior. Same error message.
From the OmniShar log:
OmniSharp server started.
Path: /home/piranha/.vscode-server/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.4-beta.61/run
PID: 959
As suggested I'll open a new issue.
New issue filed: see https://github.com/OmniSharp/omnisharp-vscode/issues/4223
Most helpful comment
A fix is available in this pre-release build - https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.23.6-beta1. Instructions for installing our beta releases https://github.com/OmniSharp/omnisharp-vscode/wiki/Installing-Beta-Releases