10

Visual Studio 2013 (vs) compiles a solution fine when manually building (i.e., it reports "Build succeeded", there are no errors in the error list, and running a program shows the latest changes). However, when vs starts building in the background (for Intellisense?), then errors start to come up for recently added extension methods. The extension methods are underlined in red, and right-clicking on them to "go to definition" results in an error that says "Cannot navigate to [method name]".

Extension methods that were created (in the same classes as the methods listed in the erroneous error messages) previous to when this started happening do not show up in the error messages.

I have done a build clean, to no avail.

I do not have resharper installed.

How do I reset the intelisense cache in Visual Studio 2013? I see instructions for Visual Studio 2008, but not for Visual Studio 2013.

Jimmy
  • 5,131
  • 9
  • 55
  • 81
  • Have you closed the project and reopened or closed VS and reopened? I've noticed VS sometimes caches some things for background processing only and it sometimes needs to be restarted to clear it. – Tim Jul 31 '14 at 14:03
  • @Tim Yes, I tried that and the errors came back after restarting. – Jimmy Jul 31 '14 at 14:04
  • Try the steps here to reset your Intellisense: [Visual Studio 2012 - Intellisense sometimes disappearing / broken](http://stackoverflow.com/a/13376771/3864867) - should work for VS 2013 as well. – Jason Z Jul 31 '14 at 14:16
  • @JasonZ Edit > IntelliSense does not have a "refresh local cache" submenu in Visual Studio 2013 – Jimmy Jul 31 '14 at 14:54
  • 2
    @Jimmy did you try the other steps? How about deleting your .suo file? – Jason Z Jul 31 '14 at 15:00
  • It doesn't solve your problem but it may help to know that VS provides IntelliSense but the compiler (csc.exe) does the actual compiling. (That will change somewhat in the future when the compiler provides parsing and binding information to any program that wants it.) – Tom Blodget Jul 31 '14 at 16:51
  • The "using" clauses imports the right namespaces for the extension methods? Other idea is to kill .suo and .user files and restart visual studio. Maybe helps. – Eric Lemes Jul 31 '14 at 17:55

6 Answers6

10

For Visual Studio 2015, my solution didn't have an .sdf file, and restarting didn't help. However, the following steps fixed my problem:

  1. Close Visual Studio (important)
  2. Go to [solution folder]\.vs\[solution name]\v14
  3. Delete the .suo file
  4. Start Visual Studio
apk
  • 1,550
  • 1
  • 20
  • 28
8

It turns out that closing all open files, then shutting down Visual Studio, and restarting fixed the issue. pff!

Jimmy
  • 5,131
  • 9
  • 55
  • 81
  • Ha! Simple restart of VS did not work for me, but closing all the files first (and running a clean) worked! Thanks! – Jess Feb 20 '15 at 17:20
3

I had a similar problem that I resolved by deleting *.sdf file in the solution directory. VS2013 will re-create it.

UPDATE This is what I know now: https://stackoverflow.com/a/38708050/90475

Community
  • 1
  • 1
GregC
  • 7,737
  • 2
  • 53
  • 67
  • +1. This is the intellisense database file. If you're having problems with intellisense, this is the first thing to try. – Cameron Aug 15 '14 at 14:31
0

After testing all above mentioned solutions simply clean and build worked for me.

Aneeq Azam Khan
  • 992
  • 1
  • 10
  • 23
0

In VS2010, the only thing that worked for me was removing and adding the reference again.

perencia
  • 1,498
  • 3
  • 11
  • 19
0

Very old question, but it happened to me also with VS2019. I have multiple projects in my solution: right-click on the project -> "Unload Project" for each one, and then reload them. This worked for me.

  • Clean + Build, or
  • Close all the files + restart VS + clean

Those didn't work (for me).

User42
  • 1