Why does intellisense and code suggestion stop wor

2019-01-16 06:07发布

问题:

I have been having issues with Intellisense in Microsoft Visual Studio 2012. I will be working in a project, editing code and whatnot (after a period of time, anywhere from 5 minutes to over an hour) and all of a sudden, no more code suggestions or intellisense. Both seem to stop working completely at the same time.

The only solution that I have tried is to reset all my settings, close out of Visual Studio completely and reopen the project again. Is there a better solution or an update that will fix this?

回答1:

I spent a lot of time researching the same problem. Some solutions related this bug with some referenced assemblies. Others said that Microsoft.Windows.Design.Extension.dll and .Interactivity.dll should be in the references of the project. But none of these solutions worked for me.

I think it is a bug in Visual Studio 2012, Microsoft has to fix it.



回答2:

I should note that I haven't had the issue since upgrading my RAM. I can't confirm if it's related but the problem was prevalent when I had 2-4GB RAM. No problems since going to 8 and 16GB.

If only one file/window appears to be affected, close and 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:

  • Tested in VS 2013/2015

Logging possible causes:

  • Copy/pasting controls in a source page. I found that my designer.vb file didn't update from this, either.
  • Copy/pasting code from another page that caused an error because the code copied referred to a control that wasn't on the page I was pasting to.
  • C++ project has corrupt .ncb file

(Please add to comments if you notice behavior that causes this.)



回答3:

What works for me is removing the dynamically-built .suo file (Solution User Options), in the .vs (hidden) directory located at he same path as the solution file.

I have this problem sometimes coming back, and it's on different project's/solutions, but never VS wide. New Projects always work fine.

Running VS2015 Professional Update -2-



回答4:

I am having the same issue; Intellisense randomly will stop showing in some files, but not others. I just had it happen to me again. Hitting Ctrl + Space won't show anything in Form1, switching to Form2 or any other class will pop up the list as expected. Restarting Visual Studio usually does the trick, though it's highly annoying and ridiculous for such a basic feature to be broken...



回答5:

It didn't work for me with all those steps. Strangely enough I noticed Intellisense was working for another solution in visual studio 2015, but not for a specific one.

I located and deleted the .suo file and restarted visual studio. That fixed it for me.



回答6:

I found a solution that works for me 100% of the time (I do not have ReSharper installed). Pressing Refresh in Solution Explorer makes IntelliSense come back.



回答7:

What worked for me is by disabling and then re-enabling the Resharper

Goto
Tools -> Options-> Resharper ->General

Click
Suspend -> This disables the resharper

Then check your Intellisense is working or not. In my case, it did and then I resumed the Resharper.

If this does not work, you might need to Goto
Resharper -> Options-> Environment -> Intellisense -> General

And
Change Intellisense to Visual Studio



回答8:

I had the same problem on Visual Studio 2010 on C++ and I surpassed it by Tools -> Options -> Text Editor -> C/C++ -> Advanced -> Disable database -> False, Ok ; Close VS; open VS and voila.



回答9:

I was facing this problem in Visual Studio 2015 + C#.

After a while, I solved this way:

1) To go: Tools -> Options -> Text Editor -> C#

2) Check these options "Auto list members" and "Enable virtual space".

Probably, some extensions, like R#, disable these options for use their tools.



回答10:

I am facing the same issue with Visual Studio 2015 Preview. I have closed that respective file and re-opened it. That fixes it for me :).



回答11:

In my case, I had added an .ascx.cs into the project via right-click => "Include in Project", but the project had it set as "Content" instead of "Compile". Once I set this to "Compile", intellisense began working again.



回答12:

If anyone is still having this issue, simply close the solution and then reopen it.



回答13:

I have VS2012 update 4 and the problem is intermittent, but once it strikes on that particular page being edited it is there to stay. One solution is simply to close the page and re-edit it.

Here's some KBD shortcuts to try to reboot it, but don't know if they work.

Visual Studio keyboard shortcut to display intellisense

None of those solutions worked for me, BTW I'm using C#...

I think this is another IS bug.... it's had lots of issues in the past.



回答14:

@TonyL's answer didn't work for me, but I noticed Intellisense stopped working in the foo class after I changed the method signature in the bar class.

Closing and reopening the foo.cs file fixed it.



回答15:

One of the thing that just helped me is

  1. Deleting every project file that is out there. My project has 10 folder, 30+ files.
  2. Recreating the project.

This takes about 5 mins - but saves a lot of time as intellisense actually started working.

One thing to note was that the memory usage (right top corner of VS 2013 ultimate) shows about 40% drop.



回答16:

Try to install the update 1 package, link. I have had the same problem and solved when I installed the update.



回答17:

I had the same issue, it turned out to be that nuget packages were not automatically downloaded for a solution i downloaded from the repository freshly, thus intellisense was not available since none of the required packages to show the right suggestions were available.



回答18:

im currently watching a MVA python tutorial on youtube and noticed my intellisence had also disappeared, soon after they expalined why,

something along the lines of this (excuse my lack of proper coding vocabulary i am new to programming but i have found the solution)

Answer: " Visual studio can not always guess what you are trying to input - therefore it does not always realise that it needs to give you a hint, for example if you are trying to use a string within a variable and need intellisense to give you options for that strings content, you must sometime tell visual studio that this variable actually is a string.

example:

name = ' ' # insert this line to tell visual studio that your variable is a string.
name = input('whats your name? \n') 
name = name.upper() #then when you type name.u.... it will give you intellisense


回答19:

I had the issue in just one file. After creating the new class and working on it, it hadn't been added to the scope of my project. So when I closed and reopened my solution the following day, the file wasn't in the project scope.

Adding the existing item to the project scope fixed it for me.



回答20:

In my case, I was simply unobservant at first and didn't see that one of the 30+ projects in my solution said "(load failed)" even though one of its files was still loaded in the editor, but had no intellisense. Reloading the project did the trick.



回答21:

Intellisense did not recognized an imported namespace in my case, although I could compile the project successfully. The solution was to uncheck imported namespace on project references tab, save the project, check it again and save the project again.



回答22:

I had this problem when some of the dependent assemblies are changed but locked by an other instance of visual studio (2015).



回答23:

My solutions (I was using perforce) is to load the entire solution instead of the individual file.

Originally I had loaded a file by click on it in perforce

Solution Close VS (which closed the individual file) Reopened by starting the solution file instead of the individual file



回答24:

If you are using Master Pages then create a blank master page use that master page in your content page. If this resolve the problem then it means your original master page have some problem. Port your original code step by step to new master page and test after each port if intellisense is working properly. This trick solved my intellisense problem.



回答25:

For python, try clicking on the "Python X.X" button on the left side of the bottom status bar and changing it to different values.

This is the only thing that worked for me.



回答26:

MS Visual Studio 2017 Pro, C++ projects

Too many good answers for this question. This worked for me:


IntelliSense works only when i load the project by double clicking the solution file.

I tried all the above answers with unfortunately no luck. Dll's, setting, dependencies...you name it. It sucks that you have to go through all that for an autocomplete....miss my Vim config....



回答27:

I've dealt with this for as long as Visual Studio existed. And yes, even in the current version it still fails (especially for large projects.)

I want to share small free tool that my friend and I wrote to address this exact same issue. You basically close your solution, drag its folder into the icon for this tool and it will reset all intermediary files for you. (Read the text manual inside if you want to know which ones. It's not just one file.)

I use it to clean up all my VS projects. So here you go: