Sebi
Sebi

Reputation: 4532

Refreshing the auto complete (IntelliSense) database in Visual Studio

I've noticed that the auto complete feature in Visual Studio no longer works properly once my project has reached a certain size (in my case ~4,100 lines of code). I've also noticed that performance also degrades once the number of third-party libraries increases (namespaces and class attributes and methods are no longer visible).

Is there a way of manually updating the auto completion database or create a new one for an existing project?

I am currently working under Visual Studio 2008, but I have experienced this issue in Visual Studio 2010 as well.

Upvotes: 86

Views: 135531

Answers (10)

Ruina
Ruina

Reputation: 365

I had issues with the razor and tried a lot of things including:

  1. Clean and Rebuild the Solution:

    • Right-click on the solution in Solution Explorer.
    • Select Clean Solution.
    • Once the clean operation completes, right-click again and select Rebuild Solution. This often forces Visual Studio to regenerate the necessary files and refresh its IntelliSense.
  2. Restart Visual Studio:

    • Close all instances of Visual Studio.
    • Reopen your project. This can clear temporary issues with IntelliSense.
  3. Delete the .vs Folder:

    • Close Visual Studio.
    • Navigate to your solution directory.
    • Delete the .vs, bin, and obj folders.
    • Reopen Visual Studio and rebuild your solution.

However, none of the above things worked. In the end what I ended up doing was:

  1. I closed visual studio.
  2. I opened the project and found that there were razor files that had multiple references with conflicting directions. The same file might be included and set to content, then set to none, then reincluded and set to content again.
  3. I deleted all the references to the razor file so that it would just follow the default behavior.
  4. Deleted all the bin and .vs and obj folders in the solution.
  5. Restarted and it started working again.

I wonder if the conflicting project directions to the same razor file was causing Visual Studio (2022) to get stuck in a weird state.

I am sure my steps are a very isolated incidence, but wanted to add them here incase its helpful to others.

Upvotes: 1

Vitaly Bortz
Vitaly Bortz

Reputation: 11

Encountered a related problem ("[n] source files to parse" instead of showing the Callers Graph) with Visual Studio 2008; deleting mentioned in previous answers files didn't help; what helped was:

  • In Solution Explorer, right-clicked on my project;
  • Selected "Properties" -> "Configuration " -> "C/C++" -> "Browse Information";
  • Changed "Enable Browse Information" from "Include All Browse Information (/FR)" to "No Local Symbols (/Fr)".

Voila!

Upvotes: 1

Pavel Krassikov
Pavel Krassikov

Reputation: 596

In Visual Studio 2022, open Tools -> Options -> [type in "database" in the search box] -> Text Editor -> C/C++ -> Advanced -> Recreate Database = TRUE, and then reopen the solution. enter image description here

Upvotes: 57

Digby Jones
Digby Jones

Reputation: 131

Right click on the solution and press "Rescan Solution". It seemed to work for me. Screenshot of the menu with action highlighted

Upvotes: 13

E. Einfalt
E. Einfalt

Reputation: 71

After verifying daniol's results of Mar 15, I went into the .vs folder -> {MyProject} folder -> DesignTimeBuild folder and deleted the .dbtcache file and Intellisense now works "intelligently" with no loss of Window Layout or other .suo info. I suspect that the 'Diagnostics.DTBBLog' command offered by eq_ on Jan 4 did the same thing but that command seems no longer available, at least by that name.

Upvotes: 7

eq_
eq_

Reputation: 119

For Visual Studio 2017 (and mainly using C# projects), the following has always worked for me:

  • Open a Command Window (View/Other Windows/Command Window) [Ctrl+W,A]
  • Enter the command "Diagnostics.DTBBLog" and press enter

No need to close solution and reload etc. It was devastating to find out that for Visual Studio 2019 this command is removed...

Upvotes: 0

Andy Braham
Andy Braham

Reputation: 10171

I am using Visual Studio 2019 and have also been experiencing problems with Intellisense along with other features. I would be able to get through about 2 or 3 updates to a file before Intellisense stopped working along with code formatting.

The only way I was able to get things working again was to restart Visual Studio, I tried removing both the intellisense folder and the whole .vs folder but this didn't solve the problem, it helped but something else was going on.

I was finally able to fix this by turning off the Track changes option under

Tools->Options->Text Editor->General.

enter image description here

Upvotes: 10

Constantin
Constantin

Reputation: 8961

For VS2015, 2017 and VS2019 close Visual Studio and delete the .vs folder in the same folder as the solution. It contains among other things the intellisense database (it should be possible to delete only the files specific to intellisense, if we knew which ones). Note that if you delete the whole folder you will lose your window layout configurations etc.

For previous versions, close Visual Studio and navigate to your project folder. The *.sdf file there contains the intellisense database- if you delete this files and reopen your project in visual studio, it rebuilds the cache.

Deleting the sdf file solved the problem for me.

Sometimes working with a big solution (mainly C++ projects) becomes unbearably slow. To fix it you need to close the solution and go delete the .SDF file. After that it returns to normal again, for about a week, or so until you need to do it again.

The underlying cause is that the SDF file gets fragmented and, according to xperf profiling I've done, VS will sometimes do 20,000+ random reads from it when changing between debug and release. Putting the SDF files on an SSD fixes the problem but should not be necessary. VS needs to use the SDF file more efficiently and not do blocking SDF operations, ever.

Source: https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2255455-fix-the-delete-sdf-file-problem

Upvotes: 84

Aidan
Aidan

Reputation: 5536

For Visual Studio 2017 (and I think Visual Studio 2019 also), close Visual Studio, go into the .vs folder in your projects folder and delete all the contents apart from the .suo file, then reopen Visual Studio.

This way you can rebuild the Intellisense cache without losing your preferences.

Upvotes: 7

Goodies
Goodies

Reputation: 2069

In VS2017 I often run into this situation when I use interop to call CPP from C#, when something is changing on the CPP side.. e.g. constructor arguments.

Unload and reload the CPP project in the solution helps to solve the red lines..

Upvotes: 11

Related Questions