Visual Studio 2022未显示语法错误,IntelliSense无法正常工作

发布于 2025-01-23 22:04:33 字数 299 浏览 0 评论 0 原文

在一个项目上,我在一个属性上做了一堂课,当我尝试自动生成一类构造函数时,我会在“自动生成类构造函数失败...并将被禁用”的行中,却觉得有任何感觉。 “生成构造函数”选项已从重构菜单中取出,最重要的是,我不会再突出显示语法错误,而IntelliSense似乎无法正常工作或根本无法正常工作。

我尝试使用工具>选项>文本编辑> 各种字段,包括“ C#”和“ General” ),我看不到任何明显错误的领域。我还尝试使用Visual Studio安装程序尝试维修,但无能为力。我完全没有想法,我找不到任何与我的案子遥不可及的东西。 tia

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

顾北清歌寒 2025-01-30 22:04:33

我无法将此答复添加为评论,因为我没有50个声誉。

我在Visual Studio 2022中创建了一个.NET 6.0 C#控制台项目,添加一个类,并添加两个私有字段。选择这两个字段,按Alt+Enter快速生成构造函数。我没有遇到你的问题。

请尝试:

  1. 转到 Visual Studio Installer ,单击修改,unable Intellicode in 单个组件,然后单击修改按钮以保存更改,等待安装完成,然后重新安装 Intellicode
  2. 在Visual Studio中,转到工具 - > options-> Intellicode以检查设置是否默认。

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.
戴着白色围巾的女孩 2025-01-30 22:04:33

试用版,则可能会发生

  • 如果您使用 resharper 扩展 ; 在Visual Studio中管理扩展

  • 从左侧栏 - >导航到安装

  • 从右侧寻找“ 喷气桥resharper ...”并禁用它。

  • 关闭对话框。

  • 关闭所有Visual Studio打开Windows。

  • 再次打开您的项目之一。

  • 导航到工具菜单 - > 选项

  • 从左侧 - > 文本编辑

  • 对于C#开发人员 - > 导航到C# - >

  • in 一般 - > 取消选中“自动列表成员”,然后再次检查

  • in Intellisense - > 检查/(请取消选中并再次检查它们)以下内容:

  • “显示字符后显示完成列表”

  • “自动展示完成....”

  • “亮点..”

  • “显示完成项目过滤器”

  • “显示名称建议”

请参阅以下屏幕截图

我希望它有帮助。

“在此处inter

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

信愁 2025-01-30 22:04:33

工具/导入和导出设置/重置所有设置

此过程对我有用

Tools/Import and export settings/Reset all settings

this procedure worked for me

时光礼记 2025-01-30 22:04:33

我遇到了同样的问题,我尝试了多个解决方案,什么也没有奏效,最后我发现此问题的原因是我在Visual Studio中打开了“文件夹”文件,而不是“ SLN”文件。因此,仅打开“ SLN”文件就可以解决该问题。

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.

梦魇绽荼蘼 2025-01-30 22:04:33

转到工具菜单,然后选择选项。在Intellicode下,Select General。只是取消选中“ C#建议”。然后重新启动Visual Studio并检查是否出现智能和语法错误。

请注意,我无法弄清楚此选项的作用,因为C#代码建议似乎继续按预期工作。

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.

血之狂魔 2025-01-30 22:04:33

添加此功能是因为我是通过Google来到这里的,这比重新安装Intellisense和Visual Studio的核动作要少。

检查工具>选项...>文本编辑>一般的。就我而言,我没有选中“显示错误”,并且忘记了我这样做了。

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.

羅雙樹 2025-01-30 22:04:33

我不再出现语法错误了,而IntelliSense不再出现
似乎正常工作或根本工作

在Visual Studio 2022中添加控制器时, 我遇到了类似的问题。控制器。

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

删除&lt; compile remove =“控制器\ ...” /&gt; < /code>修复了Intellisense。

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.

白云不回头 2025-01-30 22:04:33

对我有用的唯一一件事是:

  1. 关闭视觉工作室
  2. 在项目中删除.VS,OBJ和BIN文件夹,
  3. 再次开放Visual Studio

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
才能让你更想念 2025-01-30 22:04:33

步骤1-卸载Visual Studio
步骤2-升级到Windows 11
步骤3-安装Visual Studio

对我有用

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

this works for me

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文