dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 672 forks source link

Intellisence not working in newest version (v 2.0.328) #6056

Closed ZhouYixxx closed 1 year ago

ZhouYixxx commented 1 year ago

Long story short, the Intellisence stops working when I updated the C# extension to the newest version(v 2.0.328) . I solved this issue by reverting the extension to v1.26.0. Hope to find out what happens in the latest release soon. I attached some screenshots below.

image

image

AdamRussak commented 1 year ago

partly solved for me by enabling omni server...

in the extension output I see its stuck... image

arunchndr commented 1 year ago

@ZhouYixxx would you share the C# log on v 2.0.328 from when intellisense does not work?

in the extension output I see its stuck...

@AdamRussak that log message is misleading although the server completely started. It was fixed last week.

AdamRussak commented 1 year ago

None fhe less I got some intelisense only by rolling back.

jtotht commented 1 year ago

@ZhouYixxx would you share the C# log on v 2.0.328 from when intellisense does not work?

I’m also facing this issue. The log output, if I select C# from the dropdown, is exactly what @AdamRussak shared in https://github.com/dotnet/vscode-csharp/issues/6056#issuecomment-1667328094, except that the Dotnet path is different because I’m on Windows. I’ve left it running for like five minutes, tried to use IntelliSense, hover over things I should get a popup description of (methods, variables etc.), but I didn’t get more output (nor did these things work).

JustinGrote commented 1 year ago

Probably dupe of: https://github.com/dotnet/vscode-csharp/issues/6024

ZhouYixxx commented 1 year ago

@ZhouYixxx would you share the C# log on v 2.0.328 from when intellisense does not work?

in the extension output I see its stuck...

@AdamRussak that log message is misleading although the server completely started. It was fixed last week.

OK, on the whole I got the same output just as @AdamRussak put. This issue Probably dupe of: https://github.com/dotnet/vscode-csharp/issues/6024 Here is the output of V1.26.0 in which the intellisence works properly.

Starting OmniSharp server at 8/9/2023, 2:56:33 PM Target: d:\VS2022_repos\Leetcode-Solutions\VSCode_Practice

OmniSharp server started with .NET 7.0.100 . Path: c:\Users\BG-007.vscode\extensions\ms-dotnettools.csharp-1.26.0-win32-x64.omnisharp\1.39.7-net6.0\OmniSharp.dll PID: 22184

    Starting OmniSharp on Windows 10.0.19045.0 (x64)
    Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
    Using the 'dotnet' on the PATH.
    DotNetPath set to dotnet
    Located 1 MSBuild instance(s)
        1: .NET Core SDK 7.0.100 17.4.0 - "C:\Program Files\dotnet\sdk\7.0.100\"
    Registered MSBuild instance: .NET Core SDK 7.0.100 17.4.0 - "C:\Program Files\dotnet\sdk\7.0.100\"
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    Detecting Cake files in 'd:\VS2022_repos\Leetcode-Solutions\VSCode_Practice'.
    Did not find any Cake files
    No solution files found in 'd:\VS2022_repos\Leetcode-Solutions\VSCode_Practice'
    Queue project update for 'd:\VS2022_repos\Leetcode-Solutions\VSCode_Practice\VSCode_Practice.csproj'
    Detecting CSX files in 'd:\VS2022_repos\Leetcode-Solutions\VSCode_Practice'.
    Did not find any CSX files
    Configuration finished.
    Omnisharp server running using Stdio at location 'd:\VS2022_repos\Leetcode-Solutions\VSCode_Practice' on host 17396.
    Loading project: d:\VS2022_repos\Leetcode-Solutions\VSCode_Practice\VSCode_Practice.csproj
    You are running the 'restore' operation with an 'HTTP' source, 'http://nexus.playco.cn/repository/nuget-hosted/'. Non-HTTPS access will be removed in a future version. Consider migrating to an 'HTTPS' source.
    Successfully loaded project file 'd:\VS2022_repos\Leetcode-Solutions\VSCode_Practice\VSCode_Practice.csproj'.

d:\VS2022_repos\Leetcode-Solutions\VSCode_Practice\VSCode_Practice.csproj d:\VS2022_repos\Leetcode-Solutions\VSCode_Practice\VSCode_Practice.csproj(0,0): Error: You are running the 'restore' operation with an 'HTTP' source, 'http://nexus.playco.cn/repository/nuget-hosted/'. Non-HTTPS access will be removed in a future version. Consider migrating to an 'HTTPS' source.

    Adding project 'd:\VS2022_repos\Leetcode-Solutions\VSCode_Practice\VSCode_Practice.csproj'
    Update project: VSCode_Practice

Here is the output of v 2.0.328, it seems stuck.

Dotnet path: c:\Users\BG-007\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime.dotnet\7.0.9\dotnet.exe Activating C# + C# Dev Kit + C# IntelliCode... info: LanguageServerHost[0] Starting server...

ZhouYixxx commented 1 year ago

@ZhouYixxx would you share the C# log on v 2.0.328 from when intellisense does not work?

I’m also facing this issue. The log output, if I select C# from the dropdown, is exactly what @AdamRussak shared in #6056 (comment), except that the Dotnet path is different because I’m on Windows. I’ve left it running for like five minutes, tried to use IntelliSense, hover over things I should get a popup description of (methods, variables etc.), but I didn’t get more output (nor did these things work).

FYI reverting the extension to v1.26.0 fixed this issue

jtotht commented 1 year ago

FYI reverting the extension to v1.26.0 fixed this issue

Thanks, I know, but I wanted to help this bug be fixed as soon as possible, as reverting is not a long-term solution.

arunchndr commented 1 year ago

2.0.357 added release version support for opening projects without a solution file and thereby getting intellisense for those projects.

@ZhouYixxx / @jtotht would you confirm if that solves your issue?

dylantf commented 1 year ago

My C# extension just updated to 2.0.357 and I'm not getting any intellisense at all, it's giving me the no .net sdks found error. Not sure what's going on here, dotnet --version lists 7.0.100, and my F# intellisense works just fine.

arunchndr commented 1 year ago

@dylantf in your case, did it regress in 2.0.357? If yes, would you confirm if the .NET Install Tool for Extension Authors is installed successfully?

dylantf commented 1 year ago

Yes, that extension is installed and appears up to date. I'm not sure if there was another update since I last tried but it seems to be working now 👍🏻 . Maybe a different issue altogether.

ZhouYixxx commented 1 year ago

@dylantf in your case, did it regress in 2.0.357? If yes, would you confirm if the .NET Install Tool for Extension Authors is installed successfully?

I updated to v2.0.357 but the problem still there. I have a solution file (.sln) and project file (.csporj) in my workspace folder. image

ZhouYixxx commented 1 year ago

2.0.357 added release version support for opening projects without a solution file and thereby getting intellisense for those projects.

@ZhouYixxx / @jtotht would you confirm if that solves your issue?

Well I think I found more info about this issue. When I open the folder which contains the .sln file, the intellisence works well. Instead when I open a folder with higher level, the intellisence broke. For example, suppose I have a folder like this:

image

the intellisence works fine when I open the folder Project_CSharp and stops working when I open the higher folder Projects. Hope it helps you troubleshooting @arkalyanms .

jtotht commented 1 year ago

It took me a few VS Code restarts to get it work, but now it seems to work in my own code. In DLLs (NuGet packages, framework DLLs like Microsoft.AspNetCore.Mvc.Core.dll), while they appear as expected (human-readable C# code), clicking on or hovering over class/struct names defined outside of that particular class (including lower-case string, bool etc.) does nothing. The .NET Install Tool for Extension Authors has just been updated to v1.7.0, but it didn’t make any change. It’s better, but still quite not good.

genlu commented 1 year ago

the intellisence works fine when I open the folder Project_CSharp and stops working when I open the higher folder Projects

Thanks for the additional info. Could you please try this command to specify the solution file, and see if it solves your problem?

Image

Also, in your Projects\.vscode\settings.json file, is there a "dotnet.defaultSolution" entry?

LuckyKang79 commented 1 year ago

This issue is also reproduced on the latest version of the C# extension (v2.0.376)

ZhouYixxx commented 1 year ago

the intellisence works fine when I open the folder Project_CSharp and stops working when I open the higher folder Projects

Thanks for the additional info. Could you please try this command to specify the solution file, and see if it solves your problem?

Image

Also, in your Projects\.vscode\settings.json file, is there a "dotnet.defaultSolution" entry?

GREAT news: The issue fixed after executing Command .Net: Open Solution. and the file Projects\.vscode\settings.json not exists, but there is a setting file in the path: Projects\Project_CSharp\.vscode\settings.json and it indeed contains a "dotnet.defaultSolution" entry.

genlu commented 1 year ago

@ZhouYixxx Thanks for confirming. Closed as the original issue was resolved by explicitly selecting a solution file