55

I just installed visual studio 2012 in my machine, I previously had visual studio 2012 RC which I uninstalled before. The installation was successful, but after I open a project the C# editor is not working, is just like a plain text editor like this:

C# editor

I've tried repairing it, uninstalling it completely and then installing again, but no success.

Anyone have an idea?

I don't know if it is related, but I'm also getting this error sometimes when creating a new project or when opening an existing one:

Vs error

Thanks in advance

Adam
  • 15,537
  • 2
  • 42
  • 63
Escobar5
  • 3,941
  • 8
  • 39
  • 62
  • Out of curiosity, what happens when you start a new Project? I'm not suggesting that as a fix, just curious to see if the problem's local to old files. – 4444 Aug 16 '12 at 13:29
  • The error you recieve seems to indicate to me this is a system permission problem. I suggest trying to install the same media disk on a virtual machine and see if that works. – Security Hound Aug 16 '12 at 15:43
  • Which Windows version are you running? 7 or 8 Release Preview? – Anders Gustafsson Aug 16 '12 at 16:04
  • We have the same problem on a fresh (RC was not previously installed) x64 Windows 7 - Visual Studio 2012 Professional – Andrei Gavrila Aug 17 '12 at 07:33
  • Same issue, Visual basic .net based projects do work though! – jgemedina Aug 17 '12 at 15:58
  • Check my last post, don't know if it works for you, but my solution was to install RC and then install final version – Escobar5 Aug 17 '12 at 16:14

8 Answers8

85

I'm pretty sure the error about ManagedObjectFactory is related to the symptoms you are describing. This error indicates your Visual Studio installation (particularly the C# language service) is corrupted. Most likely this is caused by some setup issue, which we are currently working to identify.

I had a chance to investigate this error and found that one of our interop assemblies is unexpectedly installed into the GAC, while it shouldn't be. It's installed into the GAC by Windows installer, which indicates this is a setup issue. The fix is to uninstall it from the GAC, but because it's installed by Windows installer, it's more than just "gacutil /u". You need to follow the procedure described in KB873195 to remove it from the GAC:

  1. Delete a value corresponding to the “Microsoft.VisualStudio.CSharp.Services.Language.Interop” assembly from the "HKLM\SOFTWARE\Classes\Installer\Assemblies\Global\". Note the "Interop" part because there is also Microsoft.VisualStudio.CSharp.Services.Language assembly, which must be in the GAC.
  2. Start "VS2012 x86 Native Tools Command Prompt" and run "gacutil /u Microsoft.VisualStudio.CSharp.Services.Language.Interop".

Disclaimer: I'm a dev on the Visual Studio C# IDE team.

Oleg Tkachenko
  • 2,716
  • 18
  • 8
  • It worked, great! I didn't have to delete the registry entry because it was missing already. – Thanasis Ioannidis Aug 22 '12 at 00:48
  • Found and deleted the registry entry, but still failing to uninstall from GAC. So both versions of VS Express is now useless after installing the Web one... – leppie Sep 15 '12 at 11:00
  • 1
    leppie, try to follow steps in KB873195, maybe you need to delete the key under HKEY_CURRENT_USER? – Oleg Tkachenko Sep 18 '12 at 00:26
  • I tried this and the KB873195, but they did't actually work. I reinstalled the VS Express for Web 2012 and it worked. I think my problem was that I had VS Express for Web 11 and then I installed VS Express for Windows Phone. – Thea Nov 10 '12 at 12:43
  • Same symptoms, and the fix worked for me! Thanks a lot Oleg! I was almost desperate about the problem and planned to re-install Win7... – Anton Vidishchev Nov 26 '12 at 16:26
  • I couldn't find the entry in Registry :( But un-installing assembly from GAC worked for me. Express for Web 2012 working fine now :) – Anuraj Mar 22 '13 at 17:22
  • Another successful fix here! :) – Ashley Davies Mar 28 '13 at 23:13
  • This did not work for me. The interop is not in the registry and doing `gacutil /u Microsoft.VisualStudio.CSharp.Services.Language.Interop` says `No assemblies found mathing ... Number of assemblies uninstalled = 0 ... Number of failures = 0` I also tried repairing VS 2012, still the `User Types are missing from Environment / Fonts and Colors / Text Editor` and all of my User types are black. – Serj Sagan May 16 '13 at 21:15
  • @SerjSagan Same here. Seems I need to reinstall whole OS... Thanks MS! – Tomas Voracek Oct 28 '13 at 15:47
7

It may be that some of the settings are disabled in visual studio. Check the following settings:

Tools->Options->Text Editor->C#->General->Auto list members
Tools->Options->Text Editor->C#->General->Parameter information

EDIT:

Also check

Tools->Options->Text Editor->C#->Intellisense->
Show completion list after a character is typed

Here is an article on ScottGu's blog which can be helpful:D

Second EDIT:

There is one more article on ScottGu's blog titled No Intellisense with VS 2010 RC (and how to fix it). Let me know if that helps. The patch is available here.

Third Edit:

Tools –> Import and Export Settings ->  Reset all Settings

You can backup the old settings if you want. This solution is for visual studio 2012. I believe this should work

Fourth Edit: Instead of changing it for only C#, change it for all the languages

Tools > Options > Text Editor > All Languages

In general, ensure that the checkboxes in the Statement Completion section are actively checked (not grayed out). There is a possibility of having a blue square rather than a tick mark. As the tick boxes are 3 state, the square meant that "Partial Selection" was in effect. Once the tick mark is in effect, restart Visual Studio and try it again.

Final Edit:

Looks like the installation is missing some files. I would advise you to download a fresh copy of the software and install it from scratch, with the default settings active.

reggie
  • 13,313
  • 13
  • 41
  • 57
  • @Escobar5 Updated the answer with the link to a patch available for the same. Let me know if that works – reggie Aug 16 '12 at 13:32
  • that is for visual studio 2010, not 2012 :( – Escobar5 Aug 16 '12 at 13:39
  • @Escobar5 updated answer for visual studio 2012... Can you try that and let me know if that works. We can troubleshoot it further if that doesnt work – reggie Aug 16 '12 at 14:00
  • @Escobar5 Try the last part again... if not, I will research more and will update my answer later – reggie Aug 16 '12 at 14:20
  • Thanks for your time, I just checked the settings in all languages and they are activated. Also check out my edit, I don't know if it is related though – Escobar5 Aug 16 '12 at 14:26
  • @Escobar5 Updated more information. Check my insight on 3 state check boxes. – reggie Aug 16 '12 at 14:29
  • Yes, the checkboxes are actively checked, not partially – Escobar5 Aug 16 '12 at 14:37
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/15425/discussion-between-reggie-and-escobar5) – reggie Aug 16 '12 at 14:37
6

I just had the same issue as you and followed the instructions I found here.

The part I found that worked was:

  1. Try running devenv /Resetsettings in Command Prompt to eliminate the cause of corrupted settings.
  2. Try running devenv /ResetSkipPkgs in Command Prompt.
  3. Try running devenv /Safemode in Command Prompt to see if you can apply it correctly.
  4. Try running devenv /Resetuserdata in Command Prompt to reset all of your VS environment and customization settings.
Rus
  • 1,827
  • 1
  • 21
  • 32
  • 1
    devenv /Resetuserdata has done it for me, and I am getting an error now say EditorExtensionsPackage package did no load completely, but it still works, and I have the missing coloring now. – hazimdikenli Feb 20 '13 at 21:32
3

Try deleting:

  • %appdata%\Roaming\Microsoft\Microsoft Visual Studio
  • %appdata%\Roaming\Microsoft\VisualStudio
  • %appdata%\Local\Microsoft\VisualStudio

This should erase all of your visual studio settings (from all versions) and restore it to default, in case some old settings were left behind by the RC that the RTM doesn't like.

Edit:

Also you want to remove

  • My Documents/Visual Studio 2012/Settings
PhonicUK
  • 13,486
  • 4
  • 43
  • 62
1

If you have vs2012 installed in another disk(say disk D:) than the RC(installed on disk E:), try copying E:\Program Files\Micosoft Visual Studio 11 to the corresponding folder on D:.

Cheng Chen
  • 42,509
  • 16
  • 113
  • 174
1

If you have any RC version it might be the cause.

I had this issue with Visual Studio 2012 Developer Edition. I later found that i have Express Edition RC, i removed it and it solved the problem.

And then i applied eggie's solution

Shrage Smilowitz
  • 24,494
  • 2
  • 28
  • 32
0

Well, I still don't know what was the problem, but solved it by uninstalling visual studio 2012 final, then installing visual studio 2012 RC, and then without uninstalling RC installed again the final version.

Thanks everyone for your help.

Escobar5
  • 3,941
  • 8
  • 39
  • 62
  • I followed the steps described by [Oleg Tkachenko](http://stackoverflow.com/users/143055/oleg-tkachenko), in my case, I did not have to delete the key sicne it was not present. I just ran the gacutil /u ... command, restarted visual studio 2012 (had not uninstalled it) and it worked like a charm! – jgemedina Aug 20 '12 at 19:14
0

Neither Oleg's solution (or variations suggested in the comments) or Repairing Visual studio worked for me. I finally stubmbled upon a fix shown here

So 3 simple steps:

1) Close all instances of Visual Studio

2) run Developer Command Prompt for VS2012 (search in the Start Menu) as Administrator

3) Then type devenv.exe /setup

That did it for me.

Community
  • 1
  • 1
Serj Sagan
  • 28,927
  • 17
  • 154
  • 183