简体   繁体   中英

Visual Studio C# IntelliSense not automatically displaying

Just recently, my Visual Studio 2010 stopped displaying IntelliSense suggestions automatically while I am typing. I can still press ctrl+space to get it to work, but it doesn't automatically show a list of suggestions like it used to. I have already tried disabling all my extensions, restarting VS and the computer, and I have checked all the appropriate settings (Options -> Text Editor -> C# -> IntelliSense) to make sure that it is set to offer suggestions after a character is typed.

Has anyone seen this behavior before? Does anyone have any other suggestions for how I can get IntelliSense to go back to the way things were before? If not, I might just have to do a fresh reinstall of VS...

在此处输入图片说明


In prose, in case you can't see the above image:

Open Tools > Options > Text Editor. If you're only having this issue with one language, find that language; if it's for everything, click "All Languages". Right at the top, there'll be a few options labeled "Auto list members", "Hide advanced members", and "Parameter information". Make sure all of those are enabled (though the second may be disabled; if so, ignore it).

I have found that at times even verifying the settings under Options --> Statement Completion (the answer above) doesn't work. In this case, saving and restarting Visual Studio will re-enable Intellisense.

Finally, this link has a list of other ways to troubleshoot Intellisense, broken down by language (for more specific errors).

http://msdn.microsoft.com/en-us/library/vstudio/ecfczya1(v=vs.100).aspx

I'll start off my noting that this hasn't happened since I upgraded my RAM. I was at 4GB and would often have multiple instances of VS open along with SSMS. I have since gone to 8GB and then 16GB.

Here's the steps I go through when I lose intellisense.

If only one file/window appears to be affected, close/reopen that file. If that doesn't work, try below.

In Visual Studio:

  1. Click Tools->Options->Text Editor->All Languages->General
  2. Uncheck "Auto list members"
  3. Uncheck "Parameter information"
  4. Check "Auto list members" (yes, the one you just unchecked)
  5. Check "Parameter information" (again, the one you just unchecked)
  6. Click OK

If this doesn't work, here's a few more steps to try:

  1. Close all VS documents and reopen
  2. If still not working, close/reopen solution
  3. If still not working, restart VS.

For C++ projects:
MSDN has a few things to try: MSDN suggestions

The corrupt .ncb file seems most likely.

From MSDN:

  1. Close the solution.
  2. Delete the .ncb file.
  3. Reopen the solution. (This creates a new .ncb file.)

Notes:

  • This issue does not appear to be specific to C# as C++ and VB users report the same issue

  • Tested in VS 2013/2015

Steps to fix are:

      Tools
      Import and Export Settings
      Reset all settings
      Back up your config
      Select your environment settings and finish

I also faced the same issue but in VS2013.

I did the below way to fix, It was worked fine.

  1. Close all the opened Visual studio instance.

  2. Then, go to " Developer command prompt " from visual studio tools,

  3. Type it as devenv.exe /resetuserdata

  4. Restart the machine, Open the Visual studio then It will ask you to choose the development settings from initial onwards, thereafter open any solution/project. You'll be amazed.

Hope, it might helps you :)

删除解决方案文件夹中的.suo文件以解决问题。

I hit this today after the following sequence:

  1. Added a new class to my project.
  2. Closed Visual Studio, but accidentally selected No when it asked if I wanted to save changes.
  3. Reopened Visual Studio, and found that it reopened the new file automatically but without my previous changes (as expected). However, IntelliSense was no longer working in the new file.

The problem was in addition to not saving changes to the new file, it didn't save changes to the project, so after reopening Visual Studio the file was not part of the project. The Show All Files command in Solution Explorer , or Add → Existing Item... , resolved the problem.

I had the file excluded from the project so i was not able to debug and have intellisense on that file. Including the file back into the project solved my problem! :)

A new cause for this in the .net core era is having a project loaded for an unsupported .net core version. For instance if you loaded a project from GitHub that was set to use:

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
  </PropertyGroup>

But you only have 2.1 installed or find yourself using Visual Studio 2017 then the compiler wont be able to find the SDK code and thus provide intellisense.

The solution in that case might be to right click on your project and select Edit MyProject.csproj from the context menu and change the target framework as necessary:

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
  </PropertyGroup>

This assumes whatever project you loaded can actually be run under a lesser target framework.

Sometimes i've found Intellisense to be slow. Hit the . and wait for a minute and see if it appears after a delay. If so, then I believe there may be a cache that can be deleted to get it to rescan.

我只是关闭了visual studio的所有页面并重新打开..它起作用了。

Deleting the .vs folder in the solution solved my issue. You have to exit from Visual Studio and then delete the .vs folder and start Visual Studio again.

This may be due to the solution configuration changed to Release Mode instead of debug. Right click on solution -> Properties -> Configuration Properties -> Set Configuration To Debug if it is in Release.

  • Closed all my VS windows
  • Started the Visual Studio Installer and clicked 'Modify'.
  • Under 'Individual components' > 'Code Tools' > Deselected NuGet package manager and re-selected it.
  • After modifying and restarting VS, IntelliSense was working correctly again.

Found my answer on https://developercommunity.visualstudio.com/content/problem/130597/unity-intellisense-not-working-after-creating-new-1.html

[工具 -> 选项 -> 文本编辑器 -> 所有语言 -> CodeLens] 检查复选框“启用 CodeLens”是否被选中

I have just come to about this problem while installing one of the extensions and its file was deleted by my anti virus so I just disabled my anti virus and reinstalled visual studio. Suggestions are working properly without any changes made after installation.

At the bottommost right look at the blue line where Ln, Col, Spaces, UTF, CRLF,..... here the language is specified. Check that your language and the language specified there are the same. In my case, it was Django Python while I was trying to use HTML.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM