My Solution:
Toggle the CodeLens feature off and then on again.
Note: Many have found the feature to be turned off after an update so you just need to turn it back on. Thanks to @razblack for calling this out. Don’t forget to give his comment an upvote if this was your issue!
- Go into Tools -> Options… -> Text Editor -> All Languages -> CodeLens.
- Uncheck “Enable CodeLens” option and click OK.
- Go back into Tools -> Options… -> Text Editor -> All Languages -> CodeLens.
- Check the “Enable CodeLens” option and click OK.
Note: I’ve fixed the issue once before by closing the problem .cs file and then reopening it. Closing any referenced files may also be required.
My Problem(s):
Similar to the original poster, CodeLens stopped refreshing references after I made a bunch of refactors. I was seeing stale references to code that didn’t exist and I was also seeing the “- references” issue as described in the original post.
My Environment & Specific Scenario:
- Visual Studio 2015 with Service Pack 2 and Resharper Ultimate 10.0.1
- I was doing a major overhaul with a ton of refactoring and my project wasn’t compilable for an hour or so. Once I could compile the project again, the references weren’t working.