Visual Studio 2022 not showing syntax errors and Intellisense is not working properly

27.5k Views Asked by At

Working on a project I made a class with properties and when I tried to auto-generate a class constructor I got an error saying something on lines of "auto generation of class constructor failed... and will be disabled" and ever sense then the "generate constructor" option has been taken off the Refactor menu and on top of that I don't get syntax error highlighting anymore and intellisense doesn't seem to be working proper or at all.

I tried using going into Tools > Options > Text Editor > various fields including "C#" and "general") and I don't see anything obviously wrong. I also tried to use Visual Studio Installer to try to repair and that didn't do anything. I am completely out of ideas and I can't find anything that is remotely close to my case. TIA

8

There are 8 best solutions below

8
On BEST ANSWER

I can't add this reply as a comment as I don't have 50 reputation.

I created a .Net 6.0 C# console project in Visual Studio 2022, add a class, and add two private fields. Selecting these two fields, press Alt+Enter to quickly generate the constructor. I did not encounter your issue.

Please try:

  1. Go to Visual Studio Installer, click Modify, uncheck IntelliCode in Individual components, then click Modify button to save the change, wait for the installation to complete, and then reinstall IntelliCode.
  2. In Visual Studio, go to Tools->Options->IntelliCode to check if the setting is Default.
0
On

I don't get syntax error highlighting anymore and intellisense doesn't seem to be working proper or at all

I got a similar problem while adding a controller in Visual Studio 2022. The .csproj file had the following Compile.Remove entry after adding the controller.

<ItemGroup>
  <Compile Remove="Controllers\..." />
</ItemGroup>

Deleting <Compile Remove="Controllers\..." /> fixed the intellisense.

0
On

Adding this because I came here via google and this is a less nuclear action to take than reinstalling intellisense and Visual Studio.

enter image description here

Check Tools > Options... > Text Editor > General. In my case I had unchecked "Show error squiggles" and had forgotten I had done this.

0
On

Tools/Import and export settings/Reset all settings

this procedure worked for me

0
On

i had same issue , i tried multiple solution, nothing worked and i finally i found that the reason for this issue is i was opened 'folder' file in visual studio instead of 'Sln' file. so simply opening of 'Sln' file will solve the issue.

0
On

Go to Tools menu, and select Options. Under Intellicode select General. Just uncheck “C# Suggestions”. Then restart Visual Studio and check that intellisence and syntax errors are appearing.

Note, I was not able to figure out what this option does, as the C# code suggestions seemed to continue to work as expected.

0
On

This might happen If you use the ReSharper extension trial version and it is expired.

To fix this:

  • Navigate to Extensions menu-> Manage Extensions in visual studio.

  • From the left side bar -> navigate to installed.

  • From the right side look for "JetBrains Resharper ..." and disable it.

  • Close the dialog.

  • Close all Visual studio opened windows.

  • Open one of your project again.

  • Navigate to Tools menu-> option.

  • From the left side -> Text Editor.

  • For C# developers -> Navigate to C# ->

  • In General -> Uncheck "Auto list members" and check it again.

  • In intelliSense -> check/ (uncheck and check them again if it is already checked) the following:

  • "Show completion list after a character is typed"

  • "Automaticall show completion ...."

  • "Highlight .."

  • "Show completion item filter"

  • "Show name suggestions"

Refer to the following screenshots

I hope it help.

enter image description here

enter image description here

2
On

step 1 - uninstall visual studio
step 2 - upgrade to windows 11
step 3 - install visual studio

this works for me