Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Brace matching and references highlight suddenly stop working (VS2013)

Tags:

Visual Studio 2013 brace matching, references highlight, auto detect variable/,methods name changes (need to use Refactor instead), etc... are stopping to work and only work again after a VS restart. I'm writing code in C#.

Am I the only suffering/affected with this problem?

Very very annoying VS2013 problem!! It seams to only happen in large projects.

Update 1: I've realized that it happens just after I open any WinForm in VS Designer. When I come back to code editing, the brace matching and stuff is gone and I need to restart VS!

Update 2: Visual Studio 2013 Update 4 and still... NO fix!! Hello Microsoft?

Update 3: Since my solution has few votes, I'm going to summarize it here. In my case, the problem was a Thread.Sleep been called by VS Designer. It was a code error, but anyway, Designer should not run Thread.Sleep commands freezing the entire VS.

like image 201
Pedro77 Avatar asked Dec 27 '13 17:12

Pedro77


2 Answers

Until fix arrives, try disabling code lens.
tools->options->text editor -> all languages ->code lens

Or just kill the ALM shared Remoting task. if it is very high CPU.

like image 192
phil soady Avatar answered Sep 27 '22 17:09

phil soady


This is a bug in Visual Studio, and sadly one that Microsoft has decided not to fix until Visual Studio 2015 according to this ticket on Connect:

We have plans to make deeper improvements, but those won't happen until the next major release of Visual Studio because we will be taking advantage of presence of the .NET Compiler Platform. While I'm closing this issue, please be aware that we have work planned for the next release of Visual Studio to correct it.

Even so, I was able to mitigate this issue enough that CodeLens is usable again (personally, I use #3 and #4):

  1. Go to Tools > Options... > Text Editor > All Languages > CodeLens and make sure only the stats you care about are checked. The fewer things checked, the faster CodeLens will be.
  2. Change your Source Control plugin to None. This completely resolves the issue for me, but it means losing the author/change history info provided by CodeLens.
  3. After loading a solution, open Task Manager as an administrator and right-click on the Microsoft.Alm.Shared.Remoting.RemoteContainer.dll processes (there may be more than one) and Set priority to Below Normal or Low. (You will have to do this every time you open Visual Studio)
  4. If your CPU has multiple cores, after loading a solution, open Task Manager as an administrator and right-click on the Microsoft.Alm.Shared.Remoting.RemoteContainer.dll processes (there may be more than one) and click Set affinity and uncheck one or more cores. (You will have to do this every time you open Visual Studio)

I have found that only #2 can resolve the issue completely, but #3 should be enough to stop the freezing caused by the process saturating the available resources, though the process will still cause high CPU utilization until it finishes processing. Your mileage may vary with #4.

like image 27
David Schwartz Avatar answered Sep 27 '22 17:09

David Schwartz