locked
Intellisense Autocomplete Not working for Visual Studio 2010 VB code

    คำถาม

  • I have the ubiquitous "intellisense not working" issue... here's my particular scenario: I have a solution with multiple projects... in one (Class Library) project, intellisense works great.  In another (web service), the intellisense does not work.  It used to, but is now failing. I googled this and discovered that it's quite a common issue, with all sorts of potential fixes.  None seem to work for me:

    I've tried <ctrl><alt><space> ....... I've dried devenv /ResetSettings ....... I've tried excluding/including web/config ....... I've tried removing the .suo file ....... I've tried looking for an ncb file.

    None of these work.  What's disturbing is that in the same Visual Studio session, in the same solution, I can flip up to the other project, and in there, Intellisense works great.  In fact, in my editor MDI, I can have the code from one project in one tab with Intellisense working, and the code from the other project in another tab, not working.  Go figure!

    This suggests a project-related issue, but I'm at a loss to find it.  Aside: the entire codebase compiles cleanly without even any warnings, so that should have nothing to do with it.

    Any pointers would be appreciated.

    • แก้ไขโดย JohnJPS 15 กุมภาพันธ์ 2554 15:29 typos
    15 กุมภาพันธ์ 2554 0:45

คำตอบ

  • Figured it out.  In this particular case, we upgraded from VS2008 using CVS behind the scenes to VS2010 using TFS... we also migrated from "web site" to "web app" for project types.  During the change from "web site" to "web app," our code files all got marked as "content" rather than actual code.  This means they were ignored by the compiler, including no intellisense or "go to definitions", etc.

    Long story short... if you're having the intellisense issue, another thing to check is the "Build Action" for your code file... just look at the file's properties and make sure the "Build Action" property is set to "Compile".  Voila - everything comes back.

     

    • ทำเครื่องหมายเป็นคำตอบโดย JohnJPS 17 กุมภาพันธ์ 2554 18:18
    17 กุมภาพันธ์ 2554 18:18

ตอบทั้งหมด

  • IS is context sensitive.  The fact that it works in one project and not another only tells us that IS is working and is not completely broken.  When IS needs information it requests that information from the language service associated with the currently open document.  It is up to the LS to give IS the information to display.

    The .ncb file is the legacy IS file.  For managed projects you won't have one nor will you have one under VS2010 since IS moved to a database format.  The .suo file has nothing to do with IS nor will /ResetSettings help you.

    The problem resides in your web service project itself.  Do you get any IS at all?  Meaning if you add a new code file and start typing do you get any IS information at all.  At a minimum it should start throwing keywords at you.

    If you get basic IS support then the problem resides in the references you're using.  If only the system types appear and none of your custom types then it is probably a bad reference.  If not even the system types show up then it is something more complicated.  Is this a new project or one that was upgraded from VS 2008?

    Michael Taylor - 2/16/2011
    http://msmvps.com/blogs/p3net

    • เสนอเป็นคำตอบโดย Paul Zhou 17 กุมภาพันธ์ 2554 9:38
    16 กุมภาพันธ์ 2554 15:05
    ผู้ดูแล
  • Figured it out.  In this particular case, we upgraded from VS2008 using CVS behind the scenes to VS2010 using TFS... we also migrated from "web site" to "web app" for project types.  During the change from "web site" to "web app," our code files all got marked as "content" rather than actual code.  This means they were ignored by the compiler, including no intellisense or "go to definitions", etc.

    Long story short... if you're having the intellisense issue, another thing to check is the "Build Action" for your code file... just look at the file's properties and make sure the "Build Action" property is set to "Compile".  Voila - everything comes back.

     

    • ทำเครื่องหมายเป็นคำตอบโดย JohnJPS 17 กุมภาพันธ์ 2554 18:18
    17 กุมภาพันธ์ 2554 18:18
  • Great, that worked a treat for me. No idea how it got changed to "Content", but changing back to "Compile" did the trick. Thanks.

    24 กุมภาพันธ์ 2554 17:15
  • Found your post after experiencing the same problem, but when I set it to Compile, I get an error about a duplicate reference :

    ERROR The namespace '<global namespace>' already contains a definition XXXX 

    where XXXX is the name of the WebService, but for the life of me I cannot find the duplicate (the "find all references" only returns one hit), and I cannot change the name of the webservice without breaking it. 

    So I had to set the code behind file back to Content so I could at least get it to compile.


    Peter (BTMI)
    28 มกราคม 2555 9:38
  • This is a compilation error related to your references and not an IDE issue.  Please post your question in the C# General forum.

    Michael Taylor - 1/28/2012
    http://msmvps.com/blogs/p3net

    28 มกราคม 2555 14:55
    ผู้ดูแล
  • I had the same problem, I tried different methods suggested in different discussion forms, but none worked fine in my case. But in between I found the intellisense is not working for a single solution and finally found the compilation error makes the intellisense not working. So in order to reach your problem you may have go through these steps

    1. Compile the entire solution and correct the compilation error. If it is not working do the following steps too
    2. devenv.exe /ResetSettings
    3. devenv /resetuserdata
    4. Goto settings and check the following setting are there


    2 มีนาคม 2555 9:58
  • I have this same problem (Intellisense doesn't work and Go To Definition doesn't work).

    However, you can't just change the web service build action from Content to Compile ... it will break the projects ability to compile/build correctly.

    My work around is to simply just edit any line in the Web Service, even just putting in a blank space or carriage return will fix the problem (*.svc.vb).

    This IS an IDE bug and I suspect it might be specific to TFS.


    • แก้ไขโดย Robin Ainscough 5 กันยายน 2555 23:14
    5 กันยายน 2555 23:10
  • Robin your question is off topic for this forum.  Your question is related to VB which is an entirely different language written by an entirely different team. The fact that it shows up in the same IDE isn't relevant.  The IDE just hosts the languages and their providers.  Please post your question in the VB IDE forums.

    6 กันยายน 2555 1:20
    ผู้ดูแล
  • I think the relevance is that the exact same IDE bug is present for both VB and C# ... so yes I think this is the correct thread to post on.

    Agree that parser will operate differently based on the syntax (aka language), but given that it's broken for both C# and VB it would appear to me a common shared element is responsible for this bug.  Separating out this response/post to some other forum will only take away useful information regarding the problem.  Unless of course Microsoft engineers don't do any code re-use and sharing across parsers ... but wouldn't that be funny if that were the case ;)

    7 กันยายน 2555 20:47