Re: Visual Studio Code Html Intellisense

0 views
Skip to first unread message
Message has been deleted

Pamula Harrison

unread,
Jul 12, 2024, 9:21:32 PM7/12/24
to frusdochandli

It's always fun when Visual Studio (ie @drunkvs) can't recite the alphabet backwards: The code below builds just fine when running through the compiler, but Visual Studio displays Intellisense errors in the Error Window and in the code with underlined squiggles:

visual studio code html intellisense


Descargar Zip - https://lpoms.com/2yOAEW



Note the Intellisense error drop down is a new feature so you may not see it in older versions of Visual Studio. Not sure when it arrived but it was in one of the late VS 2015.x updates.

The .vs folder holds solution related temp data including the .suo file that caches intellisense and some debug data. That folder also holds Web site configuration data for Web projects and a few other things. It's safe to delete this folder - Visual Studio recreates it when it's missing.

In these older versions you can fix Intellisense issues by deleting the Solution's .suo file. Deleting the .vs folder in newer version nukes the .suo file which is responsible for cached IntelliSense and also some cached Debug data. When VS acts up and reports whacky errors that seem wrong, the burning down the .suo file is a nice quick thing to try first.

The .suo file contains cached IntelliSense data and once that file is off, no amount of recompilation or clearing the project is going to help. Nuke the .suo file. or in VS 2015 or later the .vs folder and get back to sanity.

I have a standard set of steps I tend to go through when I get compiler errors that are wrong. Well, usually it's me who's wrong, not the compiler but on occasion I get to be right and the compiler is really wrong.

This has gotten a lot better, but for a while invalid compiler errors were a big problem with the .NET SDK projects (.NET Core / .NET Standard) and in those cases the solution for me usually is (and still occasionally is):

While Visual Studio's Clean project feature is supposed to address this, Clean will only clean up files the project knows about. If you've removed or renamed assemblies there may still be left over files in project output folders and deleting them cleans out the project completely.

This often fixes odd left over file issues that can cause strange compilation behavior. I never really considered Intellisense failure previously because Visual Studio didn't differentiate compiler and IntelliSense Errors (or more accruately I didn't notice the dropdown). I'd see errors in the Error list, yet my project would compile successfully, which was even more confusing.

It's nice that Visual Studio now explicitly shows these errors separately as Build and Intellisense errors, so you can take the sepearate actions to clean up this mess. In the past when the errors weren't separated it was even more confusing with compiles succeeding, but the error list showing errors.

I have exactly this problem. The program compiles, but Intellisense is giving lots of errors. This sounds as very useful information to fix that, but where is the .vs folder located ??? Can't find it with Windows search, I am using VS2017...

Robert, the .vs folder is hidden by default, so make sure you have Windows Folder Options set so that hidden folders are visible. But, you should find the .vs folder in the same directory as the .sln file.

I've still got this problem in the latest Visual Studio 2019, clearly Microsoft aren't very interested in fixing it. If you've got a lot of solutions, it can get very annoying. This command should destroy all .vs folders recursively from wherever you run it. Test it first though!

Because I'm using Blazor, this may or may not apply to your solution, but to get rid of the phantom errors I simply deleted the files in the following folder, closed, and then re-opened the solution:C:\Users\AppData\Local\Temp\VSFeedbackIntelliCodeLogs\Suggestions\

I think what's happening is that the .cshtml.cs file gets deleted, but Intellisense doesn't recognize it's gone and continues to serve up errors using some cached values stored on disk. The offending files appear to be in the subfolders of \Suggestions, specifically:...\Suggestions\output\versions.cshtml.g.#.cs

So we had this issue recently in VS 2019, with an older project. It wasn't just IntelliSense showing errors that weren't really there, we also had an issue where we couldn't navigate to certain references in the project. The issue was in the project file. We had multiple references to different Microsoft.Net.Compilers & Microsoft.CodeDom.Providers.DotNetCompilerPlatform versions. After cleaning these up...everything was gravy. Hope this helps someone.

Deleting the .vs file works, but the problem comes back quickly. I didn't see the problem at all until updating Visual Studio (Microsoft Visual Studio Community 2019, Version 16.11.11) > Does anyone know of a way to permanently fix this?

d3342ee215
Reply all
Reply to author
Forward
0 new messages