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

Intellisense is gone (again) #6024

Closed
Skyedra opened this issue Aug 4, 2023 · 63 comments
Closed

Intellisense is gone (again) #6024

Skyedra opened this issue Aug 4, 2023 · 63 comments
Assignees
Milestone

Comments

@Skyedra
Copy link

Skyedra commented Aug 4, 2023

Type: Bug

Definitely related to the latest crop of issues: microsoft/vscode-dotnettools#317

Not sure what happened; saw some c# update fly past when I booted up today and now intellisense doesn't work. I don't see anything terribly relevant like I normally would in the logs when autoupdate breaks something (like roslyn load error, omnisharp load error, etc).

This is like the fifth time an autoupdate has broken intellisense for me, so this is getting to be pretty frustrating. I don't need my IDE to autoupdate, I just need it to work. Gonna try to figure out how to stop autoupdates now. I respect it's a free tool, but when I'm down like this there's a real financial impact to me that doesn't make it worth me being microsoft's unpaid QA. Sorry for frustration.

Extension version: 2.0.320
VS Code version: Code 1.79.2 (695af097c7bd098fbf017ce3ac85e09bbc5dda06, 2023-06-14T08:59:55.818Z)
OS version: Linux x64 6.2.0-26-generic
Modes:

System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i7-13700K (24 x 5300)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 1, 1, 1
Memory (System) 62.55GB (48.87GB free)
Process Argv --unity-launch
Screen Reader no
VM 0%
DESKTOP_SESSION plasma
XDG_CURRENT_DESKTOP KDE
XDG_SESSION_DESKTOP KDE
XDG_SESSION_TYPE x11
@Skyedra
Copy link
Author

Skyedra commented Aug 4, 2023

FYI reverting to v1.26.0 seems to fix

@Skyedra
Copy link
Author

Skyedra commented Aug 4, 2023

Log comparison, may be useful.

Old version (intellisense working): C# tab empty, but this is shown in omnisharp log:


Starting OmniSharp server at 8/3/2023, 5:28:07 PM
    Target: /project-path-redacted/core

OmniSharp server started with .NET 6.0.120
.
    Path: /home/skye/.vscode/extensions/ms-dotnettools.csharp-1.26.0-linux-x64/.omnisharp/1.39.7-net6.0/OmniSharp.dll
    PID: 185343

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Unknown 0.0 (Unknown)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to /usr/lib/dotnet/dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: .NET Core SDK 6.0.120 17.0.1 - "/usr/lib/dotnet/sdk/6.0.120/"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: .NET Core SDK 6.0.120 17.0.1 - "/usr/lib/dotnet/sdk/6.0.120/"
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/project-path-redacted/core'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Did not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in '/project-path-redacted/core'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/project-path-redacted/core/core.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/project-path-redacted/core/src/Org/AStar/Roy-T.AStar/Roy-T.AStar.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/project-path-redacted/core'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/project-path-redacted/core' on host 184753.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /project-path-redacted/core/core.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/project-path-redacted/core/core.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/project-path-redacted/core/core.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /project-path-redacted/core/src/Org/AStar/Roy-T.AStar/Roy-T.AStar.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/project-path-redacted/core/src/Org/AStar/Roy-T.AStar/Roy-T.AStar.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/project-path-redacted/core/src/Org/AStar/Roy-T.AStar/Roy-T.AStar.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: core
[info]: OmniSharp.MSBuild.ProjectManager
        Found referenced project outside root directory: /project-path-redacted/CommonSharp/CommonSharp.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/project-path-redacted/CommonSharp/CommonSharp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/project-path-redacted/CommonSharp/CommonSharp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Roy-T.AStar
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /project-path-redacted/CommonSharp/CommonSharp.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/project-path-redacted/CommonSharp/CommonSharp.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: CommonSharp
[info]: OmniSharp.OmniSharpWorkspace
        Adding analyzer reference: /usr/lib/dotnet/sdk/6.0.120/Sdks/Microsoft.NET.Sdk/analyzers/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll
[info]: OmniSharp.OmniSharpWorkspace
        Adding analyzer reference: /usr/lib/dotnet/sdk/6.0.120/Sdks/Microsoft.NET.Sdk/analyzers/Microsoft.CodeAnalysis.NetAnalyzers.dll
[info]: OmniSharp.OmniSharpWorkspace
        Adding analyzer reference: /usr/lib/dotnet/packs/Microsoft.NETCore.App.Ref/6.0.20/analyzers/dotnet/cs/System.Text.Json.SourceGeneration.dll
[info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers
        Solution initialized -> queue all documents for code analysis. Initial document count: 520.
Received response for /v2/getcodeactions but could not find request.
[warn]: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService
        No symbol found. File: /project-path-redacted/core/src/Underworld/Modding/ModSpeciesFacade.cs, Line: 179, Column: 13.

New version (intellisense broken): No omnisharp anymore, but this is C# tab:

Dotnet path: /home/skye/.config/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.9/dotnet
Activating C# standalone...
info: LanguageServerHost[0]
      Starting server...
[Info  - 5:36:04 PM] [LanguageServerProjectSystem]Loaded MSBuild at /usr/lib/dotnet/sdk/6.0.120
[Info  - 5:36:04 PM] [LanguageServerProjectSystem]Loading /project-path-redacted/core/src/Org/AStar/Roy-T.AStar.sln...
[Warn  - 5:36:04 PM] [LanguageServerProjectSystem]Failure while loading /project-path-redacted/core/src/Org/AStar/Roy-T.AStar.Benchmark/Roy-T.AStar.Benchmark.csproj: Could not find a part of the path '/project-path-redacted/core/src/Org/AStar/Roy-T.AStar.Benchmark/Roy-T.AStar.Benchmark.csproj'.
[Warn  - 5:36:04 PM] [LanguageServerProjectSystem]Failure while loading /project-path-redacted/core/src/Org/AStar/Roy-T.AStar.Tests/Roy-T.AStar.Tests.csproj: Could not find a part of the path '/project-path-redacted/core/src/Org/AStar/Roy-T.AStar.Tests/Roy-T.AStar.Tests.csproj'.
[Warn  - 5:36:04 PM] [LanguageServerProjectSystem]Failure while loading /project-path-redacted/core/src/Org/AStar/Roy-T.AStar.Viewer/Roy-T.AStar.Viewer.csproj: Could not find a part of the path '/project-path-redacted/core/src/Org/AStar/Roy-T.AStar.Viewer/Roy-T.AStar.Viewer.csproj'.
[Info  - 5:36:04 PM] [LanguageServerProjectSystem]Successfully completed load of /project-path-redacted/core/src/Org/AStar/Roy-T.AStar/Roy-T.AStar.csproj
[Info  - 5:36:04 PM] [LanguageServerProjectSystem]Completed (re)load of all projects in 00:00:00.4611082

New version doesn't seem to try to load all loaded projects, just the first one in the workspace?

@eduardoscheffer
Copy link

csharp-extension-bug

FYI reverting to v1.26.0

@ZhaoYuNing123
Copy link

csharp-extension-bug

FYI reverting to v1.26.0

how to revert?

@hongnv55
Copy link

hongnv55 commented Aug 4, 2023

@ZhaoYuNing123 It's easy by install another version
ảnh

@BrianCArnold
Copy link

BrianCArnold commented Aug 4, 2023

Can I ask why "break thousands of people's workflows with absolutely no warning or explanation" was on the roadmap for the Visual Studio Code C# extension this month?

@bbuchanan
Copy link

Having the same problem, reverting to 1.26 is a workaround.

@jasonmalinowski
Copy link
Member

@Skyedra: thanks for the logs, that's very helpful!

The C# extension will be loading all of the projects listed in the solution file. Looking at your two sets of logs, I'm guessing it means you have projects that aren't in the solution file (like your core.csproj), but it also looks like your solution file has some things that aren't being loaded by Omnisharp (like it's trying to load Roy-T.AStar.Viewer.csproj, but can't find it). Is your solution file out of date with what is otherwise in your source folders? Do the projects it's failing to find actually exist?

@JustinGrote
Copy link

JustinGrote commented Aug 4, 2023

Revert to 1.26 worked for me too. I don't have a solution file, only a .csproj, is that going to be required going forward, if so, why? It worked just fine before.

EDIT: Alternative workaround is enabling the dotnet.server.useOmnisharp setting also seems to fix it for now (only if you don't use C# dev kit)

@Skyedra
Copy link
Author

Skyedra commented Aug 4, 2023

@jasonmalinowski I'm not using a .sln for any of my code on the project (I'm not actually familiar with generating one outside visual studio classic, and thought that was just a legacy import thing), but I do have a .code-workspace:

{
	"folders": [
		{
			"path": "core"
		},
		{
			"path": "hatch"
		},
		{
			"path": "Switchboard"
		},
		{
			"path": "Bridge"
		},
		{
			"path": "Supervisor"
		},
		{
			"path": "LoadTester"
		},
		{
			"path": "CommonSharp"
		}
	],
	"settings": {
		"omnisharp.useModernNet": true,
		"omnisharp.enableRoslynAnalyzers": true
	}
}

Pretty sure the two settings were workarounds from previous omnisharp autoupdate breakage, though as omnisharp isn't used anymore I imagine those settings wouldn't affect anything.

Looking at the core.csproj in particular (where astar lives inside of (src/Org/Astar, next to src/ProjectName), there is a Roy-T.AStar.sln in the directory tree but it's not used. (It's a library that got pulled into the source tree path directly, I'm guessing because project-specific edits had to be made at some point)

core.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
	 <OutputType>Library</OutputType>
	 <DefineConstants Condition="'$(SET_PRIVBUILD)'=='true'">$(DefineConstants);PRIVBUILD</DefineConstants>
	 <DefineConstants Condition="'$(SET_LOCALGAMETEXTPRIVATE)'=='true'">$(DefineConstants);LOCALGAMETEXTPRIVATE</DefineConstants>
	 <!-- Following two lines appear to fix a "Error CS0579 Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute'" that suddenly showed up one day -->
	 <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
	 <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute> 
  </PropertyGroup>

  <ItemGroup>
	<Content Include="GameText.xml" CopyToPublishDirectory="PreserveNewest" />
	<Content Condition="'$(SET_LOCALGAMETEXTPRIVATE)'=='true'" Include="GameTextPrivate.xml" CopyToPublishDirectory="PreserveNewest" />  <!-- TODO: Don't include on public build, if it matters.-->
	<None Include="maps/**" CopyToPublishDirectory="PreserveNewest" LinkBase="maps/" />
	<None Include="shops/**" CopyToPublishDirectory="PreserveNewest" LinkBase="maps/" />
	<None Include="testSaves/**" CopyToPublishDirectory="PreserveNewest" LinkBase="testSaves/" />
	<None Include="procedural/**" CopyToPublishDirectory="PreserveNewest" LinkBase="procedural/" />
	<Content Include="OldSaveImportRenameMap.txt" CopyToPublishDirectory="PreserveNewest" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="MoonSharp" Version="2.0.0" />
    <PackageReference Include="WeightedRandomizer" Version="2.0.1" />
    <PackageReference Include="ZstdNet" Version="1.4.5" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />	
  </ItemGroup>

  <ItemGroup>
	<ProjectReference Include="..\CommonSharp\CommonSharp.csproj" />
  </ItemGroup>
</Project>

So it is a bit of a mystery why it's pulling an unused/unreferenced .sln file in a deep subfolder given the .csproj for that subproject doesn't reference it. And then ignores the src folder entirely.

@Skyedra
Copy link
Author

Skyedra commented Aug 4, 2023

Also, project tree if it helps:

find . | grep -P "(.*)(csproj|sln|code-workspace)$"
./hatch/hatch.csproj
./as3tocs/as3tocs.csproj
./Bridge/Bridge.csproj
./CommonSharp/CommonSharp.csproj
./Supervisor/Supervisor.csproj
./LoadTester/LoadTester.csproj
./core/src/Org/AStar/Roy-T.AStar.sln
./core/src/Org/AStar/Roy-T.AStar/Roy-T.AStar.csproj
./core/core.csproj
./Switchboard/Switchboard.csproj
./ProjectNameHere.code-workspace

(as3tocs is not actively used, so it's not in the code workspace)

@jasonmalinowski
Copy link
Member

@Skyedra: That is very helpful to have the project tree, so thanks. Just answering your comments in order:

Pretty sure the two settings were workarounds from previous omnisharp autoupdate breakage, though as omnisharp isn't used anymore I imagine those settings wouldn't affect anything.

Yeah you won't need those if Omisharp isn't active. (and generally you shouldn't need them going forward regardless...)

So it is a bit of a mystery why it's pulling an unused/unreferenced .sln file in a deep subfolder given the .csproj for that subproject doesn't reference it. And then ignores the src folder entirely.

The v2 extension more aggressively prefers the solution file, or at least our assumption was if there was a solution file, you wanted that used. Did you have omnisharp.enableMsBuildLoadProjectsOnDemand set in your user options?

@Skyedra
Copy link
Author

Skyedra commented Aug 5, 2023

Thanks for the info; a couple thoughts so breaking this into sections:

User prefs:

I don't believe I have that setting in user prefs. Here's what I do have in settings.json:

{
    "telemetry.enableCrashReporter": false,
    "workbench.sideBar.location": "left",
    "editor.insertSpaces": false,
	"editor.detectIndentation": false,
	"debug.openExplorerOnEnd": true,
	"debug.console.closeOnEnd": true,
	//"omnisharp.path": "latest",
	//"omnisharp.path": "1.37.17",
	"debug.onTaskErrors": "showErrors",
	"editor.rulers": [
		120
	],
	"debug.openDebug": "openOnSessionStart",
	"diffEditor.ignoreTrimWhitespace": false
}

Prioritization of solution files vs csproj files:

I don't think prioritizing a solution file deep within the subtree is ideal. Also odd to ignore a csproj in the root of the subproject folder over a sln in a deeper folder. But more generally, I would definitely prefer trying to stick as close to the compiler logic as possible.

My expectation would be something like:

  1. For each project in workspace
    A. Use whatever logic dotnet build would do in that folder to determine project scope

(I respect due to being different tools, this simplification is perhaps much easier said than done. Just selecting based on there being a csproj or sln in the subproject's root folder would probably solve most cases, including my own)

Also, if only one subproject at a time can be active (as in omnisharp), I can live with the intellisense project selector at the bottom like omnisharp had. However, being able to not deal with that fiddling would be a major feature worth upgrading for.

User confusion on solution files in vscode:

My impression as a user (which may not be accurate!) is that sln's are legacy and have been replaced by the set of smaller/user-readable files like csproj/code-workspace/launch.json/etc. My impression is they were mostly intended for easily migrating old projects from Visual Studio -> VS Code and not for using in new projects.

I'm not deeply opposed to solution files, but I haven't used them since c++ days so they carry a certain amount of, uh, emotional baggage? I wouldn't want to have to manually add each cs file to a solution file, and manually keep directory tree vs solution tree filenames synchronized, etc. Also, I seemingly can't manage sln with the IDE, and I recall them being a PITA to do by hand... so all that is to say, I'm not much inclined to switch to using sln files at first glance. I do see there is some functionality with dotnet sln now, and I may not need to manage it constantly like in the old days, so I could potentially go that route.

I also don't understand well the relationship between solution files and the new set of configs. IE, would I use a solution file instead of a workspace file? Instead of a workspace + csproj + launch files?

So, that is all a way of saying that if the legacy behavior cannot be retained then the upgrade should be opt-in and provide clear migration guide.

@navaddins
Copy link

navaddins commented Aug 5, 2023

Not sure it's bug or design. I'm same page with @JustinGrote. I'm using it for Azure function and there has no solutions. Suddenly, all Intellisense is gone. I didn't realize that's because of latest update. Uninstall/Install VS Code and uninstall/install C# for Visual Studio Code again but not luck. 😣Finally, I decided to use v1.26.0. It's working back as normal. But I'm not sure what's the solution for this. Forever, should I stick with v1.26.0? 🙄

@Kidsunbo
Copy link

Kidsunbo commented Aug 6, 2023

Install C# dev kit will fix all the problem. But I don't want this. Is this update a strategy to force us to use C# dev kit?

@egbertn
Copy link

egbertn commented Aug 6, 2023

In my output I see this...

During install

.Downloading the .NET Runtime. Downloading .NET version(s) 7.0.9 ............ Done! .NET 7.0.9 executable path: ~/.config/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.9/dotnet

Dotnet path: ~/.config/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.9/dotnet Activating C# standalone... info: LanguageServerHost[0] Starting server...

Than it it stops reporting.

The workaround is as the 'readme' suggests, to turn on Omnisharp.
Find the setting dotnet.server.useOmnisharp and enable it. Restart, and omnisharp will be installed.

How to use OmniSharp?
If you don’t want to take advantage of the great Language Server features, you can revert back to using 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.

@johannesergon
Copy link

johannesergon commented Aug 7, 2023

on our company, we are using a workspace with a lot of repositores (like a mono repo) which every repository contains one or multiple sln/csproj files and also a code-workspace file

for example my directory structure looks like this:

~/workspace/overall.code-workspace
~/workspace/repo1/project1/(project1.sln|project1.code-workspace)
~/workspace/repo1/project2/(project2.sln|project2.code-workspace)
~/workspace/repo2/project3/(project3.sln|project3.code-workspace)
~/workspace/repo3/project4/(project4.sln|project4.code-workspace)
~/workspace/repo3/project4/subproject1/subproject1.csproj
~/workspace/repo3/project4/subproject2/subproject2.csproj

and i'm opening ~/workspace/overall.code-workspace with vscode which includes all global configuration
and then i'm switching between sln files depending on which project/repository i'm working on

in this way its easier for me to search for source code accross all projects and repositories

and after updating to the version from friday the console output also stopped at
info: LanguageServerHost[0] Starting server...

@egbertn
Copy link

egbertn commented Aug 7, 2023

SOLUTION:
No downgrading, just a setting which disables dependency on the crappy language server.

How to use OmniSharp?
If you don’t want to take advantage of the great Language Server features, you can revert back to using 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.

@AdamRussak
Copy link

ninstall or disable C# Dev Kit.

this is same as downgrade basically.

i hope they will fix it soon :(

@jasonmalinowski
Copy link
Member

Going to comment to a few of you folks at once here, so my apologies if this gets a bit confusing:

@johannesergon: and then i'm switching between sln files depending on which project/repository i'm working on

I can't quite tell, based on your comments, is the current experience working well for you or are you running into friction here?

@Skyedra: Also, if only one subproject at a time can be active (as in omnisharp), I can live with the intellisense project selector at the bottom like omnisharp had

Just so I can understand your workflow a bit better, once you have VS Code open are you then using the switcher to switch between the project you're working on? Because looking at the Omnisharp behavior my gut is it'd still prefer the solution file (if that was mapped into your workspace), but then of course you could use the picker to change.

@Kidsunbo: Install C# dev kit will fix all the problem. But I don't want this. Is this update a strategy to force us to use C# dev kit?

Absolutely not! One challenge with the existing Omnisharp project loading logic is it supports a lot of different scenarios and a lot of different workflows, so it proves to be a challenge to make sure we get all the cases right.

@JustinGrote
Copy link

@jasonmalinowski by my testing, these workflows were broken by the 2.0 (release) - And please confirm 2.0 release was intentional per #6040 because it seems to me like an accidental prerelease was made public since there's no Github release:

  • If you don't have a .sln (which is very common), intellisense seems to be broken
  • If you don't have dev kit installed (because that's a licensed component), intellisense seems to be broken

Both of these assume you haven't checked the "use legacy omnisharp", though if you have and you have C# dev kit installed, it is ignored (as stated in the documentation)

@johannesergon
Copy link

@jasonmalinowski
During the day, I'm switching between our sln files. An sln file contains most of the time only one specific set of projects, and we have like 3-4 sln files which contain more projects (because we are also developing some shared libraries for our specific projects), but we don't have an sln file that contains all of our projects.

FYI:

~/workspace$ find . -type f -name "*.sln" | wc -l
26

I'm a guy who is developing central components and libraries for our projects; I have the need to search through all of our source code. This is why I (and other guys also) checked out every one of our repositories. VSCode can search a lot better than Azure DevOps 🙂. To test these changes, I'm switching between some projects and including them... Also, if I have some spare time, I'm helping other teams with their work.

I already found this setting dotnet.defaultSolution (together with dotnet-test-explorer.testProjectPath), but it's not really useful. It's important for me (and my current workflow) to switch between the sln files without switching between different workspace files and/or reloading VSCode.

I hope this is possible with the language server and will not break anything on your side; otherwise, I have to create a new workflow for me. 😅

@cchhim
Copy link

cchhim commented Aug 9, 2023

Please add

{
    "dotnet.defaultSolution": "{YOUR_SOLUTION}.sln"
}

In your settings.json file at .vscode folder. It's working perfectly for me.

@MrBrax
Copy link

MrBrax commented Aug 11, 2023

Still broken for me in anything higher than 1.26.0. I'm developing for s&box which uses an sln file in a completely different folder on the drive. My project only has a csproj which isn't even in the root.

Spoke too soon, didn't even reload the editor. Base functionality works with v2.0.356 pre-release, but it doesn't analyze the game files, so the imports are broken.

@jasonmalinowski
Copy link
Member

@MrBrax I'm not quite sure what you mean by "it doesn't analyze the game files" -- can you open a separate bug and tag me and we'll investigate from there?

@jasonmalinowski
Copy link
Member

General update for everyone: last night we uploaded 2.0.356 which adds support for loading all the .csproj in your workspace if there isn't a .sln anywhere to be found. There are of course plenty of workflows this still doesn't cover, but we wanted to get that out quickly to unblock some of the folks here. Right now that version is still in the prerelease channel but we hope to promote it soon.

@jasonmalinowski
Copy link
Member

I already found this setting dotnet.defaultSolution (together with dotnet-test-explorer.testProjectPath), but it's not really useful. It's important for me (and my current workflow) to switch between the sln files without switching between different workspace files and/or reloading VSCode.

@johannesergon There is also a "load solution" command you can invoke. If you open the command palate (by default Ctrl+Shift+P on Windows) and search for "open solution" there's a command that will let you pick the other solution file. It's a bit strange right now in picking another one doesn't close the previous solution, so if you have A.sln that has some set of projects and then you also load B.sln, we'll be processing both projects. This may not be perfect for your workflow but I hope that brings it pretty close.

@MrBrax
Copy link

MrBrax commented Aug 11, 2023

@MrBrax I'm not quite sure what you mean by "it doesn't analyze the game files" -- can you open a separate bug and tag me and we'll investigate from there?

In the current docs (that use omnisharp) it is instructed to enable roslyn analyzers or it won't get the symbols required for all the base classes and whatnot. I'm not sure if to open the issue here or for the game, considering it is invite-only and in development.

@jasonmalinowski
Copy link
Member

@MrBrax File a separate issue here (or create a discussion) so we can discuss this further. There may not be much to discuss, but it'd be good to keep the conversation separate than this one.

@MrBrax
Copy link

MrBrax commented Aug 11, 2023

@MrBrax File a separate issue here (or create a discussion) so we can discuss this further. There may not be much to discuss, but it'd be good to keep the conversation separate than this one.

The issue template seems way too complicated and i can't find discussions on this project. I'll switch back to visual studio even though it's slow as molasses.

@arunchndr
Copy link
Member

2.0.357 added release version support for opening projects without a solution file and other tweaks requested in feedback. Please let us know if there are still lingering issues for us to track.

Note: A known feature gap that we are working on is support for legacy framework projects tracked at #5721.

@johannesergon
Copy link

I already found this setting dotnet.defaultSolution (together with dotnet-test-explorer.testProjectPath), but it's not really useful. It's important for me (and my current workflow) to switch between the sln files without switching between different workspace files and/or reloading VSCode.

@johannesergon There is also a "load solution" command you can invoke. If you open the command palate (by default Ctrl+Shift+P on Windows) and search for "open solution" there's a command that will let you pick the other solution file. It's a bit strange right now in picking another one doesn't close the previous solution, so if you have A.sln that has some set of projects and then you also load B.sln, we'll be processing both projects. This may not be perfect for your workflow but I hope that brings it pretty close.

looks good for me, thank you 🙂👍
but there is one little thing which is not working well for me, everytime i change my solution, my workspace file will be modified (dotnet.defaultSolution will be set to a new value), so everybody (who is using this workspace file) have to remember to not commit this change... is there a way to avoid this?

@jasonmalinowski
Copy link
Member

@johannesergon Is that with DevKit installed?

@johannesergon
Copy link

@johannesergon Is that with DevKit installed?

Yes, currently, I'm using [email protected] (Pre-Release) and [email protected] (Pre-Release) because the C# extension recommends the C# DevKit extension.

And when I'm executing the command .NET: Open Solution or .NET: Close Solution, this property dotnet.defaultSolution will be changed.

@sharwell
Copy link
Member

I'll switch back to visual studio even though it's slow as molasses.

Have you filed a performance report for Visual Studio? Our team has a very high close rate for issues filed with these steps:
https://learn.microsoft.com/en-us/visualstudio/ide/how-to-increase-chances-of-performance-issue-being-fixed?view=vs-2019#slowness-and-high-cpu-issues

@MrBrax
Copy link

MrBrax commented Aug 15, 2023

I'll switch back to visual studio even though it's slow as molasses.

Have you filed a performance report for Visual Studio? Our team has a very high close rate for issues filed with these steps: https://learn.microsoft.com/en-us/visualstudio/ide/how-to-increase-chances-of-performance-issue-being-fixed?view=vs-2019#slowness-and-high-cpu-issues

No, but it's just a "it's how it is" issue, it's been the case for well over a decade if not two. It's just slow in general due to how heavy of an application it is.

Currently using Rider but it also has some drawbacks, hoping this plugin will get working again in the future as i prefer vscode over all other editors.

@jasonmalinowski
Copy link
Member

And when I'm executing the command .NET: Open Solution or .NET: Close Solution, this property dotnet.defaultSolution will be changed.

OK, @johannesergon I've filed microsoft/vscode-dotnettools#399 to track that.

@jasonmalinowski
Copy link
Member

I'm going to close this bug as I believe we've made enough improvements (or explained things!) to unblock everybody who is in this conversation. If I've missed your comment or your workflow is still blocked, do please let me know, but let's open a new bug to track since this one is getting a bit long.

To summarize, we've got the following changes in or clarified the following bits:

  1. If you don't have any solution files, we'll now load the project files directly.
  2. If you have more than one solution, instead of doing nothing silently we'll prompt to launch the picker. (This is merged but not shipped yet.)
  3. Folks now know about dotnet sln and how to create solution files, so if you need to specify a custom set of projects to load, you can use those. At this point, having multiple solution files would be our suggestion for those who need different subsets of projects loaded on a regular basis.
  4. Documentation better explaining our selection logic (and pointers to the dotnet sln docs) is on its way, since I think one thing we learned here was you all can't read our minds.

Thank you all for your feedback here especially explaining different workflows that we didn't anticipate. If you have a workflow that still isn't covered at all, or have other suggestions, please do file a new bug and feel free to tag me. We're still going to make more improvements here but at this point I think it's best to get new conversations now that this conversation has gone past 50 comments. 😄

@Skyedra
Copy link
Author

Skyedra commented Aug 15, 2023

Not overly thrilled all the solutions all still involve manual work to adapt to the new behavior in 2.x. Randomly breaking user workflows during autoupdates is something that's going to bleed vs code users over time.

@CarsonKompon
Copy link

CarsonKompon commented Dec 7, 2023

I'm going to close this bug as I believe we've made enough improvements (or explained things!) to unblock everybody

Unfortunately this isn't true. All this time later I have still been on-and-off encountering this issue on a few different machines throughout this month with completely different c# projects (all of which with an existing sln, not with multiple) and I've had to revert to 1.26 on all but one of my machines (thankfully its my work machine).

Not sure why they are turning a blind eye to this issue as it will only become worse as majority of users stay on 1.26 as it becomes obsolete and the root problem still isn't fixed in 2.X

EDIT:

I think it's best to get new conversations now that this conversation has gone past 50 comments.

This is pretty laughable since it only really seems they want to close this issue so people can't see how they handled the issue. Why would we make a new topic for the exact same issue that is still completely unresolved?

@jasonmalinowski
Copy link
Member

@CarsonKompon The reason I requested new issues is simply because people who are having problem with IntelliSense (for entirely unrelated reasons!) see the title for this issue, go "IntelliSense is gone" and comment here, and then we get to tease all the issues back apart. There are a huge number of systems that all have to work to get Intellisense to work in the end and if those go awry the symptom is often the same. I've also had plenty of cases where a customer thinks an issue is already filed for what they're experiencing, only to discover once we fix it, it wasn't and had they spoken up earlier we could have gotten that fixed sooner.

To confirm for your issue though, "with an existing sln", is the problem again we're picking up the solution when we shouldn't be, or the solution file does contain the projects you expect to load, and you're still not getting intellisense?

@stevephary
Copy link

its January and the issue is still there. Cant work because of this!!
I have a solution and everything but the problem stills persist, tried uninstall and install but no changes

@jasonmalinowski
Copy link
Member

@stevephary Can you file a new bug and attach logs as requested in the bug? You can also file a bug from the extension itself which will attach some information automatically. Feel free to tag me so I can take a look.

@NicoRuedaA
Copy link

Same issue as new user with VSC. Not a good start to learn C#

@ghost
Copy link

ghost commented Feb 26, 2024

Hi, I have same issue with C# intellisense. Below is what I did, to workaround and make it worked in VS Code:

  • Downgrade C# extension (ms-dotnettools.csharp) to: 1.26.0

Disable both extensions:

  • C# Dev Kit (ms-dotnettools.csdevkit),
  • Intellicode for C# Dev Kit (ms-dotnettools.vscodeintellicode-csharp).

Select C# file\project for Omnisharp Intellisense:

  • Open .cs file you want to work with => Ctrl+Shift+P => OmniSharp: Select Project => select project with your .cs file,
  • If prompt appears: "..add asset.." select Yes.

Now intellisense should works but it would be nice to have it fixed and worked with latest C# extensions.

@erwinkramer
Copy link

It seems we need to install IntelliCode for C# Dev Kit now.

@jasonmalinowski
Copy link
Member

@erwinkramer That definitely shouldn't be necessary (unless you want it of course!) Can you file a new bug for us to investigate?

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