TL;DR
The issues is caused by v2.x.x
of the Visual Studio Code C# extension which does not have the same set of features (includes some unprecedented features, but also lacks some features) as the current v1.x.x
(= OmniSharp or O#) versions. The goal in the future however is for v2.x.x
to support what v1.x.x
has already been supporting.
You have one of four options:
- Stay on >=
v2.0.320
and add a solution file (see section Update 2023-08-05) which includes your project
- Revert back to a OmniSharp powered version (versions <=
v1.x.x
) (see section Original answer)
- Go back to OmniSharp by going to the Extension settings and setting
dotnet.server.useOmnisharp
to true. Next, uninstall or disable C# Dev Kit. Finally, restart VS Code for this to take effect. (quoted from Github - dotnet/vscode-csharp - How to use OmniSharp)
- Wait for the feature parity to come in future
v2.x.x
versions (see linked Github issues in section Update 2023-08-09)
Update 2023-08-09
As pointed out in the comments below by starball and the thread What changed about the C# extension for VS Code's IntelliSense in the v2.0.320 release? on SO the general issue is that with versions >= v2.0.320
Microsoft has decided to switch to the new Roslyn Language Server instead of using OmniSharp (also often referred to as O#) which it has been using for versions prior to that (See Github Releases - Changelog v2.0.320). Microsoft did get some heat for that (see Visual Studio Magazine) as this will introduce closed-source functionality.
The new v2
, as of now, lacks some features the OmniSharp versions provided. Looking at the list of known issues there are however plans to reach a feature parity between the two versions in the future.
Here the known issues as of 2023-08-09 based on Github - dotnet/vscode-csharp - Known Issues in v2.0.320:
- Diagnostics related feature requests and improvements #5951
- [O# Parity] FixAll support for code fixes and refactorings #5735
- [O# Parity] Nuget restore #5725
- [O# Parity] Support loading projects/files without a solution file #5722
- [O# Parity] Some csproj projects will not correctly load #5721
- [O# Parity] Run and debug tests in context #5719
- Debug from .csproj and .sln #5876
Note that issue #5722 - [O# Parity] Support loading projects/files without a solution addresses the problem faced here.
With that being said, you have the possibilites as outlined in my previous answers:
- Stay on >=
v2.0.320
and add a solution file (see section Update 2023-08-05) which includes your project
- Revert back to a OmniSharp powered version (versions <=
v1.x.x
) (see section Original answer)
- Go back to OmniSharp by going to the Extension settings and setting
dotnet.server.useOmnisharp
to true. Next, uninstall or disable C# Dev Kit. Finally, restart VS Code for this to take effect. (quoted from Github - dotnet/vscode-csharp - How to use OmniSharp)
- Wait for the feature parity to come in future versions (see linked Github issues)
Update 2023-08-05
It seems the issue only occurs if you have a project which is not listed in a solution file, so you can create a solution file e.g. using dotnet new sln --name <solution name>
and then add the project(s) to that solution using dotnet sln add <project path>
.
It is working with the new version v2.0.328
(released today 2023-08-05) for me when I have all my projects added to a solution file.
Original answer
I've faced the same issue today (2023-08-04). This is due to an update of the extension to v2.0.320
. You can fix this by reverting back to version v1.26.0
.
You can revert using the UI by going to Extensions -> C# -> Install Another Version
:

There also is an open Github issue related to this.