How can I get user type C# syntax highlighting working again in VS 2012 RC?

C#Visual Studio-2012

C# Problem Overview


Somehow part of my syntax highlighting for C# code has disappeared in the VS 2012 IDE. Uninstalling, rebooting, and reinstalling does nothing, nor does resetting the colors in the options dialog.

Here are some examples of items which all appear in default (black) that normally have color which don't:

  • Attributes
  • System classes
  • My own classes

And here are some keywords that still have color:

  • using
  • public
  • void
  • var
  • for

Has anyone else experienced this and managed to fix it?

C# Solutions


Solution 1 - C#

Here is a simple solution. Go to the directory where devenv is (for 2012 RC), and type devenv.exe /setup. It will fix your problem.

devenv.exe is usually in something like C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE.

Edit: It has been suggested that you do this from the Visual Studio command prompt (Start>Microsoft Visual Studio>Tools>Visual Studio Command Prompt), and/or make sure your command prompt has administrator permissions.

Note for others: This has a very good chance of working for many other versions of Visual Studio, including 2008, 2010, 11 beta, ...

Solution 2 - C#

My problem was limited to having the "DateTime" type not showing up in light blue like other class names. I fixed it by simply switching back-and-forth between VS Themes. Discovered by accident. Much quicker than reset settings or repair install...

VS menu Tools -> Change Color Theme

Solution 3 - C#

This is what worked for me:

1 - delete all in C:\Users\userNAme\AppData\Roaming\Microsoft\VisualStudio\11.0
2 - open vs console as administrator, and run:
      devenv.exe /setup
      devenv.exe /ResetSettings

This will reset all your environment settings.

Solution 4 - C#

If none of the above work for you, delete all GUID-named folders under this registry key (make sure your Visual Studio instance is closed):

If you're using Visual Studio 2012: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\FontAndColors

If you're using Visual Studio 2013: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\FontAndColors

If you're using Visual Studio 2015: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\FontAndColors

Restart Visual Studio, and you should see a few various "User Types" to configure. You can then import your Fonts and Colors that you backed-up, and everything will be good to go. This may also work for previous and future versions of VS, but I have not tested.

Disclaimer: Make sure you export/backup your current Fonts and Colors settings before making these registry adjustments. I cannot be held responsible for you losing your configs :)

Solution 5 - C#

If you still have this issue try ResetSettings (worked for me)

NOTE: this will reset the Visual Studio 2012 settings :)

  1. close vs.

2)open cmd (as administrator).

  1. go to devnev.exe folder (something like "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE" ).

  2. type "devnev.exe /ResetSettings"

  3. open vs and look at the beautiful colors

Solution 6 - C#

Found the source of the problem: If you have the "Productivity Power Tools 2012" installed,

you should go to Tools -> Options -> Productivity Power Tools and turn off the "Colorized Parameter Help" option.

This fixed the syntax highlight problem.

Solution 7 - C#

If anybody runs in to the same problem for Visual Studio 2013 as I did, the only solution that worked for me was to first close VS2013 and then delete the following registry key:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\FontAndColors

After reopening VS2013, my syntax highlighting for types was restored.

Prior to deleting the registry key, I noticed that all of the "User Types..." settings in the Fonts and Colors section of Tools > Options were missing. Deleting the registry key restored them. They attained their default values which gave me the syntax highlighting colors I was looking for.

This was the only solution that worked for me. Switching themes, resetting my personalized settings to defaults, running devenv.exe with various command line switches to setup/reset Visual Studio did not work.

I also created the following bug report with Microsoft on their Connect site:

http://connect.microsoft.com/VisualStudio/feedback/details/810985/incorrect-syntax-highlighting-for-c-types.

Solution 8 - C#

For me "Productivity Power Tools 2012" was the cause. Nothing suggested here helped. After removing the Power Tools the colors came back.

Solution 9 - C#

I did all the things listed here and still nothing (VS2013 Update 3). I tried /setup, /resetsettings, deleting the stuff in AppData, deleting the registry keys. Still, User Types wouldn't be highlighted even in the default color scheme.

What helped in the end was opening the Fonts and Colors dialog, selecting Identifier, and making it Bold. Then removing the Bold. Instant fixage!

Solution 10 - C#

I had the same issue....just uninstalling and re-installing alone did not correct the problem. After I un-installed, deleted all remnants of VS 2012 in program files, removed all related registry keys, and deleted the VS 2012 folder from My Documents, then re-installed, user types showed up in the display items in fonts and colors and everything went back to normal. My guess is that it was an issue with one or more of the registry keys but I can't be sure of that.

Solution 11 - C#

exit devenv

go to below path hkey_current_user\software\microsoft\visualstudio!

remove 9.0 , 10.0 , 10.0_config (i mean to say all other folders except 11.0 and 11.0_config)

Now start devenv and see the magical colors get back normal

Solution 12 - C#

1 - delete all in C:\Users\userNAme\AppData\Roaming\Microsoft\VisualStudio\11.0 2 - open vs console as administrator, and run: devenv.exe /setup devenv.exe /ResetSettings1 - delete all in C:\Users\userNAme\AppData\Roaming\Microsoft\VisualStudio\11.0 2 - open vs console as administrator, and run: devenv.exe /setup devenv.exe /ResetSettings

This is what helped me...

Solution 13 - C#

  1. delete all in C:\Users\userNAme\AppData\Roaming\Microsoft\VisualStudio\11.0

  2. open vs console as administrator, and run:

     devenv.exe /setup
     devenv.exe /ResetSettings
    

This solution worked for me. Thanks alot Gaz Winter

Solution 14 - C#

If you've installed the preview of Roslyn, unintstall it. This worked for me.

Solution 15 - C#

After trying several of the solutions listed here, I eventually found that my issue was caused by a very large (488000+ characters) string variable. Highlighting was working up to that line, but not after it. Once I reduced the length of the string, highlighting in the rest of the file resumed working normally.

Solution 16 - C#

I already had VS 2012 Pro installed on my machine. I then installed VS 2013 Pro and started facing this color issue. I then deleted the HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\FontAndColors key and opened VS 2013. This approach solved my issue and the colors were back.

Solution 17 - C#

If the windows desktop is configured with a high contrast theme the syntax coloring seems to disappear completely from Visual Studio. If this is the case, select a normal windows theme and set a solid background color (if you don't want a background pictures) to restore syntax coloring in VS.

Solution 18 - C#

Problem : Class name and Syntax showing in black color

Solutation:

Step 1: Remove Key :
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\FontAndColors

Step 2: Remove folder :
C:\Users\UserName\AppData\Roaming\Microsoft\VisualStudio\12.0

Step 3: Open command prompt (admin mode) and run below command line :
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE>devenv.exe /setup
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE>devenv.exe /ResetSettings

Solution 19 - C#

It work for download this "Productivity Power Tools 2012" and install, after install this tool get this steps go to Tools -> Options -> Productivity Power Tools and turn off the "Colorized Parameter Help" option.

This fixed the keyword as syntax ActionResult is not set for default black color and highlight problem resolved.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJedidjaView Question on Stackoverflow
Solution 1 - C#GregRosView Answer on Stackoverflow
Solution 2 - C#Marc-AndréView Answer on Stackoverflow
Solution 3 - C#Leonardo HerreroView Answer on Stackoverflow
Solution 4 - C#MattView Answer on Stackoverflow
Solution 5 - C#AssafDamariView Answer on Stackoverflow
Solution 6 - C#Nir KornfeldView Answer on Stackoverflow
Solution 7 - C#prlcuttingView Answer on Stackoverflow
Solution 8 - C#Peter HedbergView Answer on Stackoverflow
Solution 9 - C#Roman StarkovView Answer on Stackoverflow
Solution 10 - C#mevansView Answer on Stackoverflow
Solution 11 - C#Rashmin JaviyaView Answer on Stackoverflow
Solution 12 - C#RishiView Answer on Stackoverflow
Solution 13 - C#user2632666View Answer on Stackoverflow
Solution 14 - C#Stelzi79View Answer on Stackoverflow
Solution 15 - C#larrehView Answer on Stackoverflow
Solution 16 - C#VipulView Answer on Stackoverflow
Solution 17 - C#Daniel WesterbergView Answer on Stackoverflow
Solution 18 - C#ShravanView Answer on Stackoverflow
Solution 19 - C#Long LeView Answer on Stackoverflow