microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
216 stars 9 forks source link

[BUG] Intellisense not working with cross targeting #1269

Closed matherm-aboehm closed 1 month ago

matherm-aboehm commented 1 month ago

Describe the Issue

In recent C# extension v2.34.12 Intellisense is randomly broken when a code file from a project with cross targeting settings (TargetFrameworks property set to more then 1 TFM) is opened. Sometimes it doesn't show anything on hovering over code and code completion isn't working and sometimes it picks randomly a single or more TFMs from the list (not only the 1st one) and wrongly shows availability of APIs for only these frameworks. VSCode_CS_DevKit_intellisense_error

When I try to restart .NET Language Server, Intellisense stops working at all and the following error is logged to output window:

[stdout] fail: Microsoft.CodeAnalysis.LanguageServer.ExportProviderBuilder[0] c:\Users\xxx.vscode\extensions\ms-dotnettools.csharp-2.34.12-win32-x64.xamlTools\Microsoft.VisualStudio.DesignTools.CodeAnalysis.dll with assembly name Microsoft.VisualStudio.DesignTools.CodeAnalysis, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a conflicts with extension loaded from c:\Users\xxx.vscode\extensions\ms-dotnettools.csharp-2.34.12-win32-x64.xamlTools [stdout] fail: Microsoft.CodeAnalysis.LanguageServer.ExportProviderBuilder[0] c:\Users\xxx.vscode\extensions\ms-dotnettools.csharp-2.34.12-win32-x64.xamlTools\Microsoft.VisualStudio.DesignTools.CodeAnalysis.Diagnostics.dll with assembly name Microsoft.VisualStudio.DesignTools.CodeAnalysis.Diagnostics, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a conflicts with extension loaded from c:\Users\xxx.vscode\extensions\ms-dotnettools.csharp-2.34.12-win32-x64.xamlTools

Steps To Reproduce

No response

Expected Behavior

No response

Environment Information

firedigger commented 1 month ago

I have the same issue. Thought not sure on different target frameworks. In my solution all projects are .NET 8 except for one legacy netstandard2.0 component.

estebanbelong commented 1 month ago

Same issue here, started happened very recently. All of our solution is in .NET 6 with some exceptions already on .NET 8

Activating C# + C# Dev Kit... waiting for named pipe information from server... [stdout] fail: Microsoft.CodeAnalysis.LanguageServer.ExportProviderBuilder[0] c:\Users\esteb.vscode\extensions\ms-dotnettools.csharp-2.34.12-win32-x64.xamlTools\Microsoft.VisualStudio.DesignTools.CodeAnalysis.dll with assembly name Microsoft.VisualStudio.DesignTools.CodeAnalysis, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a conflicts with extension loaded from c:\Users\esteb.vscode\extensions\ms-dotnettools.csharp-2.34.12-win32-x64.xamlTools fail: Microsoft.CodeAnalysis.LanguageServer.ExportProviderBuilder[0] c:\Users\esteb.vscode\extensions\ms-dotnettools.csharp-2.34.12-win32-x64.xamlTools\Microsoft.VisualStudio.DesignTools.CodeAnalysis.Diagnostics.dll with assembly name Microsoft.VisualStudio.DesignTools.CodeAnalysis.Diagnostics, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a conflicts with extension loaded from c:\Users\esteb.vscode\extensions\ms-dotnettools.csharp-2.34.12-win32-x64.xamlTools [stdout] {"pipeName":"\\.\pipe\6023db57"}

dibarbet commented 1 month ago

I believe this the same issue as https://github.com/microsoft/vscode-dotnettools/issues/1198 and https://github.com/dotnet/vscode-csharp/issues/7231

This should be fixed in next week's prerelease, will report back here once it is available.

dibarbet commented 1 month ago

The 2.39.28 prerelease version of the C# extension was released today - @matherm-aboehm can you check if it fixes the issue?

Thorry84 commented 1 month ago

I had the exact same issue with the same error when restarting the language server. Updating to the prerelease 2.39.28 fixed the issue for me.

firedigger commented 1 month ago

Can confirm the issue is fixed as well on 2.39.28, can be closed after a normal release I suppose.

dibarbet commented 1 month ago

Thanks all for confirming - closing this issue. The 2.39.28 should be uploaded to the release channel in the next day or two.

matherm-aboehm commented 4 weeks ago

@dibarbet Sorry for late reply, I was on vacation. It looks like the Intellisense issue is resolved in v2.39.29, although it still switches between random TFM contexts, when VSCode is restarted, which you can see when hitting F12 - Go to definition. Also the restart of .NET Language Server still shows the same error as initially described. But the hover texts now shows right information for the code elements, so this is good enough for me. I just want to inform you that there are still some "hiccups" with the LSP.

dibarbet commented 4 weeks ago

It looks like the Intellisense issue is resolved in v2.39.29, although it still switches between random TFM contexts, when VSCode is restarted, which you can see when hitting F12 - Go to definition.

Great that the original issue is resolved - the TFM switching issue should hopefully improve soon, we're actively working on adding the ability to change the active document TFM. In 2.39.29 we started showing the active TFM in the language status bar (which you can pin so it always shows instead of clicking on it) image

Also the restart of .NET Language Server still shows the same error as initially described.

Yup, that is not fixed yet, and hasn't reached the top of the priority list since there is a workaround (reload window).

matherm-aboehm commented 3 weeks ago

Thank you for the hint, this was easy to miss.