JDD_11
JDD_11

Reputation: 73

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

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

Upvotes: 7

Views: 43006

Answers (9)

John Doe
John Doe

Reputation: 374

The only thing that worked for me was:

  1. Closing Visual Studio
  2. Deleting the .vs, obj, and bin folders in the project
  3. Open Visual Studio again

Upvotes: 0

Mohammad Naushad M
Mohammad Naushad M

Reputation: 66

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.

Upvotes: 3

Sampath
Sampath

Reputation: 84

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.

Upvotes: 0

Ammar Al-Habib
Ammar Al-Habib

Reputation: 99

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

Upvotes: 5

Murkrow
Murkrow

Reputation: 31

Tools/Import and export settings/Reset all settings

this procedure worked for me

Upvotes: 3

Shivam Goel
Shivam Goel

Reputation: 375

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

this works for me

Upvotes: -10

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.

Upvotes: 1

MichaelB
MichaelB

Reputation: 591

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.

Upvotes: 1

Peng Ge
Peng Ge

Reputation: 299

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.

Upvotes: 14

Related Questions