Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013 reporting erroneous "does not contain a definition for" error for recent extension methods

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.

like image 605
Jimmy Avatar asked Jul 31 '14 13:07

Jimmy


Video Answer


2 Answers

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

like image 191
Jimmy Avatar answered Sep 23 '22 00:09

Jimmy


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
like image 45
apk Avatar answered Sep 26 '22 00:09

apk