Visual Studio 2012 syntax coloring for C# types [duplicate] - syntax-highlighting

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?

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, ...

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

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.

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 :)

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).
3) go to devnev.exe folder (something like "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE" ).
4) type "devnev.exe /ResetSettings"
5) open vs and look at the beautiful colors

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.

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.

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

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!

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.

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

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...

delete all in C:\Users\userNAme\AppData\Roaming\Microsoft\VisualStudio\11.0
open vs console as administrator, and run:
devenv.exe /setup
devenv.exe /ResetSettings
This solution worked for me. Thanks alot Gaz Winter

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

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.

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.

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.

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

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.

Related

Visual Studio 2015 does not start

We have installed Visual Studio 2015 Professional on Windows 7. It was working fine. But after we installed updates from the menu Tools-->'Extensions and Updates' today the Visual studio does not start anymore. we tried using 'run as administrator' as well. From the Start menu we right click on 'Visual Studio 2015', then 'run as administrator', the usual dialog box asking for permissions appears, we click on 'Yes', splash screen for Visual Studio appears for a second and then disappears. On the Task Manager, it does not appear as well.
Re-starting the system does not help either. .NET 4.6 is installed and Visual Studio 2012 on the same system is working fine.
UPDATE 1
The issue started after we installed the last update (from within VS2015) that had something to do with universal apps I think.
UPDATE 2
At the exact time when I start VS2015, one Windows Event log gets generated under security section as follows:
EventID 6281
Microsoft-Windows-Security-Auditing
Audit Failure
Message: Code Integrity determined that the page hashes of an image file are not valid.
The file could be improperly signed without page hashes or corrupt due to unauthorized modification.
The invalid hashes could indicate a potential disk device error.
File Name: \Device\HarddiskVolume3\Windows\System32\l3codeca.acm
I had the same problem recently after I upgraded one of the packages. I tried "everything" and the only option that worked was the /Setup switch (I was logged in as Administrator, but don't think that's required).
c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE>devenv.exe /Setup
c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE>devenv.exe
https://msdn.microsoft.com/en-us/library/ex6a2fad.aspx
Here's what worked for me.
Go to the Command Prompt and navigate to the folder with devenv.exe
In my case it was C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
then execute
Devenv.exe /ResetSettings
https://msdn.microsoft.com/en-us/library/ms241273.aspx
I had the same problem. It was caused by Visual Studio Extensions adding paths to $PATH, which made $PATH grow too long (>2048 bytes).
This breaks VS and lots of other stuff on your machine.
Removing outdated and duplicate lines from $PATH made it short enough and VS2015 and everything worked again.
If nothing above works (like in my case) then open a registry editor, go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio and delete all 14.0 directories.
It will reset all VS settings and next launch will be like first one after installation.
Found answer here
After trying the other solutions in this thread, what finally worked for me was:
From an elevated Command Prompt, navigate to "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE".
Execute:
devenv.exe /Log C:\temp.log
https://msdn.microsoft.com/en-us/library/ms241272.aspx
The log should contain a matching set of Begin and End entries for every extension:
<description>Begin package load ...
...
<description>End package load ...
If the last extension is missing the End package load entry, you need to uninstall that extension.
Execute:
devenv.exe /SafeMode
https://msdn.microsoft.com/en-us/library/ms241278.aspx
Go to "Tools -> Extensions and Updates" and uninstall the offending extension.
Exit VS. Start VS as normal. In case it still doesn't work, repeat the procedure.
Nothing of above helped me, What helped me was to copy devenu.exe from other computer which had VS installed and then replacing it with mine computers devenu.exe.
Run C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Blend.exe
Right click on some file in "Solution Explorer" such as "default.aspx" and select "Edit in Visual Studio"
For me it only shows Visual studio 2015 window without disappearing and showing IDE or any error.
Non of following solutions worked for my normal domain user but there was no issue running it with administrator.
Devenv.exe /ResetSettings
Reinstalling
Repairing
Watching event viewer for more details
Cleaning temp and cleanup and finally seeing some error
Finally I deleted my whole profile from admin via [System properties]-> [Advanced] -> [Profile] and it resolved the problem.
Just before that copy your user folder somewhere or at least your desktop and user folders and also your bookmarks and settings.
I tried several methods above and even re-installed VS but it did not work. The final solution was to really completely remove all the settings and registries of VS with the tool VisualStudioUninstaller. After uninstalling and re-installing it, it is up again.

Visual Studio 2015 Intellisense not working

I have a fresh install of VS2015 on windows 8 and intellisense doesn't work at all (nothing!) in any environment.
I also have VS2013 (with Resharper 8)on the same machine which works fine.
Any ideas before I go through a re-install?
Probably the problem is with ReSharper, I'm running VS2013 and VS2015 on the same machine without any issues.
I would try:
In Visual Studio 2015, go to 'Tools | Options | Text Editor | C# | General both "Auto list members" and "Parameter information" should be checked.
If that doesn't work I would try to disable ReSharper in VS2013 and try to get the normal intellisense working. Same procedure as above if ReSharper fails to restore the settings.
Note: Only do this as a last resort, because it will reset virtually all of your user preferences, including where your toolbars are, environment fonts etc.
I reached here because my intellisense was giving 1000's of errors in the Error List after installing Visual Studio 2015 on a clean Windows 7 machine.
The answers here did not apply to me, but this answer on StackOverflow: Razor intellisense not working in VS 2015, worked for me.
Run this command from the VS "IDE" folder:
devenv.exe /resetuserdata
When I restarted Visual Studio it took several minutes to "prepare Visual Studio 2015 for the first time", and when I reloaded the project all the intellisense errors had gone.
For info, this is how I navigate to the command prompt:
Right-click the Visual Studio 2015 shortcut on the start menu to get the context menu:
Select 'Open file location' to open a new Explorer window:
Left-click anywhere on the white to deselect devenv.exe, then shift + right-click to bring up the extended context-menu, then select 'Open command window here':
Then paste the command: devenv.exe /resetuserdata
When Visual Studio starts, it's been reset:
And when I load project, errors are gone:
Make sure Tools -> Options -> Text Editor -> C# -> IntelliSense -> "Show completion list after a character is typed" is checked. I had installed and uninstalled VS 2017 and that's when IntelliSense stopped working in VS 2015 for me.
How I fixed it:
I went to Tools -> Extensions and Updates and uninstalled every extension I wasn't using. There were only about 3 of these. One I remember removing was "Microsoft Office Extensions", or something like that. I don't have either resharper or Xamarin, which I've seen mentioned in relation to this. When I'd finished Visual Studio restarted itself, and XAML intellisense was back! Relief...
It may be the case that all you need to do is uninstall any one extension, and the resetting that VS does after that fixes the problem.
Further detail:
I don't recall changing anything specifically (eg. installing anything), when this problem suddenly appeared. I suspect it was due to a Windows update. I was really worried about this one!
I tried restarting VS, and restarting my PC, several times without success, and also checked my intellisense settings. I tried the suggestion of unchecking them and checking again.
My F# code had also lost intellisense. C# was fine, except for XAML.
It was in all VS2015 projects.
Version: Visual Studio 2015, Windows 10. January 2018.
I might be kind of late for the party, but hopefully this helps out anyone.
Please note, the below is just one possible cause for the issue described in this topic.
Your issue might be that you have one project/library referencing the other, but the Target Frameworks are different.
Make sure the frameworks are compatible and see if intellisense picks up your using references, etc.

Visual Studio 2013 - User types color is gone

Just installed Visual Studio 2013 (it seems there was no choice - tried to download vs 2012 from Microsoft but they automatically redirect me to 2013...).
I noticed that all those things that used to be colored in turquoise - like classes, types, attributes - are now plain black! I mean all those things that trigger the little blue "smart tag" thingie that when you press ctrl+dot you get a little option to add the appropriate "using" statement.
I've looked through and through in the tools > options > fonts and colors. In vs 2012, under "display items", there were entries such as "user types - XXXXX" which were colored turquoise. But in 2013 they're gone too! :-(
Productivity power tools is not installed...
Anyone?
For others who run into this, where the accepted answer doesn't work: try closing your project and deleting your suo file.
I tried devenv.exe /setup (as an admin, in a VS command prompt), I tried changing and restoring themes, I tried rebooting, etc. Nothing worked, but deleting my suo file fixed it.
I had the same issue in VS2013, fixed that with devenv.exe /setup
See
How can I get user type C# syntax highlighting working again in VS 2012 RC?
If you've installed the preview of Roslyn, unintstall it. This worked for me.
Disabling and then enabling Productivity Power Tools 2013 extension resolved the issue for me.

Visual Studio 2008 Blank Tool Window

I have a blank property window that I can not get rid of in Visual Studio 2008 SP1. I have tried every thing to get rid of it.
If I close it it shows right back up after going into debug mode or restarting visual studio. I have tried every thing to fix all the way to reinstalling VS with no luck.
Does any one have a solution for this?
Use the following fix:
Close all instances of Visual Studio Navigate to the following directory (I am using 2008 – for a different version change the 9.0 to reflect the correct version number/folder)
"%userprofile%\Local Settings\Application Data\Microsoft\VisualStudio\9.0".
You should see four files:
toolbox.tbd
toolbox_reset.tbd
toolboxIndex.tbd
toolboxIndex_reset.tbd
Move these files to another folder (or, if you are very brave, delete them altogether. Note, this is very much a case of “Worked on my (colleague’s) PC” – do this at your own risk. Restart Visual Studio and hey presto, your Toolbox should be back to where it needs to be. The user in question did not have any custom items in his toolbox so I can only assume that the fix reverted the toolbox to the original Visual Studio state.
Click Window, Reset Window Layouts.
If that doesn't help, click Tools, Import and Export Settings, Reset all settings. (But backup your current settings)
One thing to try is via the Visual Studio 2008 command line you can run the following command.
devenv /resetsettings
This will restore to factory settings, this could clear up the issue, re-install wouldn't do this for you.

TFS vs2005 always get on accessing a file

In vs2005 opening a file causes a dialog to pop up "Contacting server to get a list of items to update"... everytime... I'm not checking out / editing ... just opening to view.
Reset vs2005 settings etc ... but to no avail ...
No settings appear to be diff. between mine and other devs boxes here.
Appears to be nothing on google.
No addins etc
driving me nuts - anytime something changes on the server I get the change ... not to mention the interruption.
any ideas?
This is obviously not normal behaviour as you can tell from looking at the other developers machines. I would personally suspect a plug-in of some sort. You could try looking in Tools, Add-in Manager to see if anything is there. If that doesn't work, close Visual Studio and start a Visual Studio 2005 Command Prompt and then type
devenv /SafeMode
And see if the problem still occurs. If it does you could try resetting Visual Studio by typing the following at a Visual Studo 2005 command prompt (warning it will reset all your preferences etc)
devenv /ResetSettings
But all of these are a shot in the dark - I've never seen the behaviour that you are describing...

Resources