VC++ Intellisense

Internal Mechanism

Internally the Visual Studio IDE interacts with editor and the language parsers to create a list of tokens that are updated frequently. In this process the background threads continuously update the Intellisense database. The priority of threads change automatically to make sure that the database is updated as and when user writes the code and also the delay on the IDE is minimized.

In a VC++ application, the Intellisense parser engine (feacp.dll) creates a database .ncb file and keeps it up-to-date. This ncb file can be located in the Project directory.

Intellisense Features

1. Quick Info – When we place the mouse pointer over an identifier, we can see a yellow popup box that appears on the screen. This window gives a brief description about the identifier.

2. Auto Completion – When we use period sign (.) after an object, or -> sign after a pointer, we automatically get the member lists. This is also generated if we use the scope resolution operator.

3. Parameter Help – Put a ‘(‘ sign after the function name and we get function definition which helps us write the function call. In case there are multiple overloaded functions, we get a drop down button as well.

4. Other features

• GD – Go to Definition

• XML – XML Doc Comments

• LB – Live Browsing

• CC – Case Correct

• NB – Navigation Bar

• CV – Class View

• OL – Outlining

• GR – Graying if-def code

VC++ Intellisense components

Vcpkg.dll - VC++ Language Service DLL - This dll is responsible to collect data from ncb file and perform operations like AC, QI, PH etc.

Feacp.dll – This dll is the frontend parser responsible to generate PDB data.

 

Symptoms

1. Loading project takes a long time showing “Updating Intellisense… (xxx)” in status bar. The number in parentheses shows how many background thread work items are in progress. For customers that aren’t seeing Intellisense ever complete, this information may be useful.

2. Quick-Info, Auto-Completion or Parameter-Help doesn’t work or show correctly.

3. Class-view doesn’t show-up.

4. Go-to Definition doesn’t work.

5. Visual Studio Hangs.

6.  XML documentation doesn’t work.

Troubleshooting

1. Verifying Intellisense issue (or Disabling Intellisense)

There are chances that we are misinterpreting some issues with Intellisense. We can verify this by disabling Intellisense in VC++. There is a file called feacp.dll in <VS_INSTALL>\VC\vcpackages folder. Renaming this file will disable Intellisense feature.

After disabling, if we can work with the IDE without any other issue then we can say for sure that Intellisense is causing the problem.

2. NCB is write-protected

If the NCB file is write-protected, or the project is opened simultaneously by two or more instances of Visual Studio, the Intellisense may not work as expected.

3. Updating Intellisense… / IDE hangs

This is a very common issue with Intellisense and it may occur due to a variety of reasons. There are two scenarios, either the Intellisense returns after a long time or it doesn’t return at all.
The recommended way is to check for NCB corruption and also getting the ACPLOG.

4. NCB file corruption

In some circumstances, NCB file becomes corrupted and thus the PARSER is unable to continue resulting hangs. Sometimes by deleting the NCB, the problem is resolved. But it may be a temporary workaround. The permanent solution is to find out which part of our code is causing failure.

5. ACPlog

We can generate a log file to find out the reasons behind the failure of parser. The ACPLOG can be generated from the Visual Studio IDE by adding the following option under Project Properties->Configuration Properties->C/C++->Command Line->Additional options:

/acplog:<file_name_with_complete_path>

Save and close the solution. Reopen it and try to reproduce the scenario. The log will be created.


6

. Intellisense and network build 

Building a project/solution over network is unsupported. It may encounter Intellisense issue.


7

. Is there any add-in that you are using?

Removing/disabling the add-in might resolve the issue.


8

. Opening a project when Intellisense is busy?

If Intellisense is in the middle of updating (typically in case of a huge solution) and if we open a different project by File->Recent projects, the IDE hangs and never comes back.
It is suggested to wait for Intellisense to finish its work.


9

. Is there any antivirus installed?

Try disabling the antivirus. There might be some conflict.

10. Running Visual Studio in safemode.

The safemode option in Visual Studio(Start->Run->devenv /safemode) ensures that no additional third party add-ins are loaded when VS starts. This helps us to isolate Visual Studio conflicts with other third party applications/add-ins.

/SafeMode (devenv.exe)

11. Pre-Compiled Headers

It may happen that the project is building correctly and thus you imagine that there is no error in the code. Then why Intellisense is not working? Are you using precompiled header files in your VC++ projects? Let’s try building the project without using PCH and see if build gives us any error. If yes, resolving those errors may fix Intellisense.

12. Cyclic inclusion of header files

Try identifying the header files which are creating a cyclic graph and get it fixed.

13. Is it a bug?

Check for available fixes. A simple search here will give you a list of related fixes available.


14. Still not resolved?

If by considering the above points, your issue is not resolved, you can take 3-4 hang-dumps for devenv at an interval of say 3-4 minutes along with acplogs and contact Microsoft Support.

In Visual Studio 2010, we are completely changing the Intellisense mechanism. You can find more details here.