Saturday, October 16, 2010

Arrow and Enter keys stop working in Visual Studio 2010

I found this issue with the RTM of Visual Studio 2010 recently where the arrow keys and the Enter key do not work as expected. This is a show-stopper as you can't write any code, or rather you can, you just have to write everything on 1 line!

I have 3 machines with VS 2010 installed. Each machine is fairly similar in configuration. I have only encountered this issue with 1 of those 3 machines - which makes it very hard to diagnose.

In my scenario I found the some of the arrow keys - the up key for example was acting like a tab within the code window. It would when pressed allow me to set focus on the combo box that contains classes the the current namespace.

Other people have received this issue, but the work around for them is to simply close and reload VS. In my case this didn't work. I even uninstalled all of the VS 2010 bits including the framework to no avail. This problem affected all SKU's of Visual Studio 2010 (only 2010, 2008 worked fine for me).

I should mention VS 2010 RTM used to work on this troubled machine. It must of been something I installed or configuration I changed later. I tried rolling my machine back to when I think it was working, again to no avail.

There is a bug report on Microsoft Connect here: https://connect.microsoft.com/VisualStudio/feedback/details/534869/arrow-keys-stop-working-in-editor?wa=wsignin1.0#tabs

So if you have experienced this, make sure you vote on the link above, or if you found a work around please leave a comment.

This may of been due to the fact I installed RC and beta copies of VS - as I installed pre-release copies of Windows Phone 7 developer tools. Then I installed the RM version of VS 2010 after uninstalled the pre-release versions as per the release notes.

Conclusion.....

I failed to figure out what was causing this. If I had the source code of course I could debug VS but as I don't, it was down to trial and error. I had no logging written to the event log. VS never crashed as a result of this, it is just a very annoying bug that I could not figure out what caused it.

So in the end, I had to reinstall Windows, and now.....I have VS 2010 working again!

9 comments:

Rob said...

in VS try ALT+Enter or Key Pad Enter.
that will immediately fix the issue and you can continue using VS.

Marcus said...

Unfortunately here, when I do Alt+Enter VS2010 then crashes.

Simon Hart said...

Marcus have you tried installing VS 2010 SP1? SP1 has been released since this article was written. Since I've installed SP1, I've not seem this bug.

Simon

Sam said...

I receive this problem every now and again. To resolve i generally switch to another code file from the tabs at the top, and then switch back.

Simon Hart said...

Sam, have you installed VS 2010 SP1?

stafford said...

appreciation++. This was bugging the heck out of me, I was restarting vs2010 every time this happened, however today it happened like three times. The Alt-Enter fix has resolved this for me, thanks a lot!

stafford said...

appreciation++. This was bugging the heck out of me, I was restarting vs2010 every time this happened, however today it happened like three times. The Alt-Enter fix has resolved this for me, thanks a lot!

Anonymous said...

Switching to another tab worked for me, Alt-Enter didn't and I do have SP 1.

Mike said...

alt+enter just saved me from throwing my keyboard through the monitor.
Rob........ thank you!!!