Visual C++2005的IntelliSense问题
When we are working with Visual Studio IDE, sometimes we encounter issues related to intellisense. The main objective of this article is to provide some basic troubleshooting steps to overcome some of the issues.
Lets first start with a basic understanding of IntelliSense Support in Visual C++
What is the issue?
1. Intellisense doesn’t work at all.
2. Intellisense is very slow(Giving
Updating Intellisense… in status bar)
3. Intellisense fails causing Visual
Studio to exit or Hang forever.
4. Intellisense doesn’t work for a part of
the solution.
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 <VS8INSTALL>\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. Is there any corrupt file(s)
If you are having some intellisense issues related with Project References, then you may also need to check the version of both the feacp.dll and vcpkg.dll files.
Here is a related KB article which links to the latest version of fix for this issue :
The intention to point to this article here is to get an understanding that these files are responsible for intellisense issues.
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 proceed 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 findout the reasons behind the failure of
parser. The ACPLOG can be generated from the Visual Studio IDE by adding the
following option :
/acplog:<file_name_with_complete_path>
If we build the solution, it will generate the log in the specified file. This is an ordinary text file which we can open in Notepad and can identify which part of our code is causing the parser to behave abnormally.
6. Intellisense and XML documentation
Intellisense is also helpful in generating XML code comments. For example if we press three slashes(///), it will automatically add the code comments and may also try to include the elements very similar to the way we add variable in our code.
I have encountered a case in which Intellisense was not responding after adding CDATA to XML documentation.
When customer complaints about the XML documentation code comments then it might be due to the Intellisense feature.
7. Intellisense and network build
Building a project/solution over network is unsupported. It may encounter Intellisense issue.
8. Is there any add-ins that the customer is using?
Removing the add-in might resolve the issue.
9. Opening a project when intellisense is busy?
If Intellisense is in the middle of updating and if you 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.
10. Is there any antivirus installed?
Try disabling the antivirus. There might be some conflict.
11. 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/addins.
12. Is it a bug?
Last but not the least, it would be a good idea to check List of bugs that are fixed in
Visual Studio 2005 Service Pack 1
Most of the known issues with Intellisense are going to be fixed very soon. You can contact Microsoft Support to get a hotfix.