Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code Lens won't work anymore in Visual Studio 2013

The Code Lens feature of Visual Studio 2013 won't work anymore. It says "Loading references for this method" but it takes years and actually it doesn't load them for any method at all.

It used to be working just fine but I am not sure why it stopped working. I restarted Visual Studio 2013 many times, I even restarted my computer but no luck.

Code Lens is not working anymore

It is enabled in my Visual Studio 2013.

enter image description here

like image 815
Tarik Avatar asked Dec 02 '13 22:12

Tarik


People also ask

What is code lens in Visual Studio 2013?

Microsoft Visual Studio 2013 has a new feature called Code Lens which shows the reference count of the methods along with the other information like Show Authors, bugs, work items etc.

What is Visual Studio codelens?

February 12, 2017 Wade Anderson, @waderyan_. CodeLens is a popular feature in Visual Studio Code. The essence of the feature is "actionable contextual information interspersed" in your source code.

Why is the code lens not working on TFS server?

I found out that if you block the Visual Studio with the Firewall, the Code Lens did not work. So unblock it from the firewall to make it work. CodeIndexing must be enabled on the TFS Server. You can check this setting using TFSConfig:

How to disable code lens in Microsoft Classroom?

Alternatively, if you have the class file opened, just right click on indicators and click “Code Lens” options to display the same screen as shown above to disable it.


1 Answers

I will answer my own question as I managed to solve it.

It seems each time you run your tests in Visual Studio, it stores the result of your tests in TestResults folder in the project folder and it was about 800MB in size in my computer.

I just deleted it and clean the project bin and obj folders as well (which I did for several times before and didn't really work). But removing TestResults folder did the magic.

My guess is that because of the humongous size of the TestResults folder, Visual Studio 2013 cannot load all the results etc. quickly and that's why it was taking years to show me Code Lens feature. So delete that folder time to time for better performance.

Here are some results about TestResults folder after I googled it:

  1. How to: Deploy Files for Tests: http://msdn.microsoft.com/en-us/library/ms182475.aspx
  2. How to preserve the test results directory?: http://blogs.msdn.com/b/aseemb/archive/2013/02/23/how-to-preserve-the-test-results-directory.aspx
  3. How to delete Test Results folder:http://blogs.msdn.com/b/ploeh/archive/2006/07/13/cleaningawaythetestresultsfolder.aspx

UPDATE

Even if those methods above may work for you, I realized that they actually fixed this issue since Visual Studio 2013 Update 2. So instead, please update and install it.

like image 136
Tarik Avatar answered Oct 22 '22 21:10

Tarik