Why does FontsAndColorsItems return 19 duplicate entries in Visual Studio 2012? RRS feed

  • Question

  • In Visual Studio 2012, when programmatically requesting the list of colorable items via EnvDTE.Properties ["FontsAndColors", "Text Editor"] item "FontsAndColorsItems", the resulting FontsAndColorsItems collection contains 265 items, 19 of which are duplicate items.  Specifically, when iterating through the collection using foreach in C#, the following 19 ColorableItems are duplicated:

    XML Doc Comment, XML Doc Tag, Comment, Excluded Code, Identifier, Keyword, Preprocessor Keyword, Operator, String, Number, Selected Text, Inactive Selected Text, Visible Whitespace, compiler error, syntax error, other error, compiler warning, Track Changes before save, Track Changes after save

    The style information (foreground color, background color, boldness) are identical and correct in both the original and duplicate entries.

    Is there a reason for this duplication?  Is this by design or is it a bug?  If there is a reason for the duplication, what is the reason?  I can code around this behavior by keeping track of what I've already seen, but it adds to the complexity of my code.



    • Edited by kengr Wednesday, August 7, 2013 2:21 AM
    Wednesday, August 7, 2013 2:20 AM


All replies