12

Right now in my code suddenly some part of the code is not color-coded to Visual Studio classic theme colors. I am not sure if there is some error in my code but when I define some property, for example:

public class VideoEncodeTest : AndroidPowerTest
{
    [CptfConfigAcceptedParametersClass]
    public VideoEncodeTestParameters VideoEncodeTestParameters { get; set; }

    [CptfConfigAcceptedParametersClass]
    public IBundleStrategy Strategy { get; set; }
}

I expect the type of the properties (e.g. IBundleStrategy), name of the base class (AndroidPowerTest), and name of the attribute (e.g. Strategy) to be in color-coded in blue at least. However, it is not and it is plain black. This is only happening with this particular class and not happening with other classes. I am not sure why or what could be causing it.

Any ideas on how to fix this?

5
  • 1
    Does your solution compile?
    – Matthew
    Commented Jun 17, 2014 at 1:14
  • @Matthew: yup no errors.
    – Lost
    Commented Jun 17, 2014 at 1:22
  • Do you have Resharper installed or any other plugins?
    – Brannon
    Commented Jun 17, 2014 at 3:50
  • What's the file extension?
    – ClickRick
    Commented Jun 17, 2014 at 7:04
  • Hi Guys, it turned out that I had a circular reference problem there. So VS did not error out on me(surprisingly), It did not explicitly tell me that I have Circular reference issue for some reason...
    – Lost
    Commented Jun 18, 2014 at 1:23

7 Answers 7

32

I recently had this issue after updating Visual Studio 2019.

I was able to fix it by heading to Tools > Options > Text Editor > C# > Advanced, and finally selecting Visual Studio 2019 in the Editor Color Scheme dropdown.

Screenshot for reference.

1
15

After trying a few solutions other people have mentioned to no avail, I discovered that I could fix the text coloring by simply typing something into the affected document. The act of modifying the code caused the colors to go back to normal.

2
  • 3
    VS 2022 - same resolution. Didn't even think to edit the effect file. Commented Jun 23 at 22:18
  • 5
    This problem exists in the year 2024 as well.
    – vibs2006
    Commented Jul 18 at 14:30
5

Are you sure your settings are all right, and the problem is elsewhere? You can check if your settings are not what you'd expect them to be in the 'Fonts and Colors' menu.
(Tools -> Options -> Environment -> Fonts and Colors)

You may have plugins installed which are inflicting with your current settings. If that's the case, you should try removing your add-ins, then re-installing them.

If it's certain that the problem is with your VS intellisense, first try refreshing the IntelliSense cache by selecting the 'Refresh Local Cache' option in the Edit menu of VS under the IntelliSense item.
(Edit -> IntelliSense -> Refresh Local Cache or just hit Ctrl+Shift+R)

If you still experience the problem, you should try closing VS, deleting the %appdata%\Microsoft\VisualStudio\11.0\ReflectedSchemas folder, then starting it up again to check if the problem is solved.

If neither of these could solve your problem, you can still try to reset all settings in VS. It has some chance to work, but I don't recommend it.
(Tools -> Import and Export Settings -> Reset all settings)

2
  • 1
    Hi Guys, it turned out that I had a circular reference problem there. So VS did not error out on me(surprisingly), It did not explicitly tell me that I have Circular reference issue for some reason...
    – Lost
    Commented Jun 18, 2014 at 1:23
  • 1
    Techie , thanks a lot, Ctrl+Shift+R worked like a charm !
    – A P Jo
    Commented Sep 22, 2020 at 11:33
5

This happened to me with a new project in a solution. Another member in the team had created it and when I pulled it via git I got no color coding even though the code ran fine. I also had color coding in the other projects.

What fixed it for me was simply adding a new class to the project with no color coding. Then everything started working normally again.

1
  • 1
    Amazing, I spent half an hour switching different settings
    – tony09uk
    Commented Mar 14, 2019 at 16:11
3

In case anyone stumbles on this issue in 2022 (as it still happens), what works for me is to reload or create a specific project file for the code type I want IntelliSense to work with.

For example, if I had a C# and Python project in a solution, loading the solution, IntelliSense will only work for one of the two languages. Manually loading the Python or C# project will fix both the color-code and IntelliSense for whichever language it's currently broken for.

After trying everything above, so very many times, I was able to replicate and duplicate this in my multi-language solutions.

1

My fix was to rename the file. I had originally created it as an html file. When I renamed it my intellisense came back.

0

I had this issue with python and was able to fix it by reinstalling python addon

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.