none
VS 2012 Package: Supporting Dark Themes

    Question

  • Hello,

    We officially support VS11 but have ran into issues when it comes to the dark theme. 

    We have a custom editor and are looking at the DTE properties for the font styles and colors. We are rendering what is given to us in the screenshot above and it looks great if you are not using the dark theme. Is there something we have to do to to get the color settings when the dark theme is selected?


    -Blake Niemyjski (Software Development Engineer)

    Monday, July 09, 2012 6:10 PM

Answers

All replies

  • Are you reacting to the WM_SYSCOLORCHANGE notification that occurs on theme changes? If you have a custom editor you would be responsible for refreshing things on theme switch. I believe the colors returned from the various categories should be proper for the theme, but they wouldn't just change on theme switch since they aren't any kind of smart objects returned from the color request API, they are just encoded or raw ARGB values.

    Ryan

    Monday, July 09, 2012 10:21 PM
    Moderator
  • Hi,

    While a high-res image would help, I guess that you get the correct background color (almost black) for normal text but you get the wrong background color (white) for keywords, comments, etc. Is that correct?

    If so, I have found the same issue with VS 2012 and the dark theme. It is something that really started in VS 2010 and that I reported to no avail:

    VSIP: VS 2010 Dec LCTP: EnvDTE.FontsAndColorsItems.Item(textEditorItem).Background returns 0 instead of actual background color
    https://connect.microsoft.com/VisualStudio/feedback/details/518919

    In VS 2010 you get a black (0x000000) background instead the correct (white) background for items other than the regular text. In VS 2012 you get white background (0xFFFFFF) instead of the correct (almost black) background for items other than the regular text.

    I have a workaround that consists in using always the background of the regular text, even for keywords, comments, strings, etc. but of course it losses fidelity when the user selects a different background for those items and for the regular text.

    Some days ago I tried to use the SDK services rather than the DTE properties for font colors but the problem remained, so I don't know how VS is doing to get the correct results.

    Ryan: it happens when you start VS already with the dark theme, no theme changing involved here.


    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com. My blog about developing add-ins: http://msmvps.com/blogs/carlosq/


    Tuesday, July 10, 2012 9:24 PM
    Moderator
  • Hello,

    I think you are running into this: https://connect.microsoft.com/VisualStudio/feedback/details/743557/vs-shell-package-dte-properties-is-returning-invalid-edtior-font-settings as well as your uint conversion may be wrong (not anticipating the alpha..)

    We are getting the correct background colors back (switch from dark to light theme and everything is right). It just seems like there is a filter that is applied or a second set of font settings.


    -Blake Niemyjski (Software Development Engineer)

    Tuesday, July 10, 2012 9:34 PM
  • I am confused by this:

    We are getting the correct background colors back (switch from dark to light theme and everything is right). It just seems like there is a filter that is applied or a second set of font settings.

    Are you saying DTE is returing to your editor the proper colors but they are rendering as above? Are the colors you are using custom defined just for your editor or are they the 'normal' editor category colors for things like keywords, etc...

    Ryan

    Tuesday, July 10, 2012 9:51 PM
    Moderator
  • Hello,

    Sorry for the late reply.. I never got an email alert saying this thread had been updated. I've narrowed this down to two issues with VS2012.

    It seems that DTE is returning the incorrect background color for when you switch from dark theme to light!

    Launch VS2012 with light theme.

    [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Razor Code Background: #FFE7EFF2 Foreground: Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Plain Text Background: #FFFFFFFF Foreground: #FF000000 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: HTML Attribute Background: #FFFFFFFF Foreground: #FFFF0000 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: HTML Attribute Value Background: #FFFFFFFF Foreground: #FF0000FF Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: HTML Server-Side Script Background: #FFFFFF00 Foreground: #FF000000 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: HTML Comment Background: #FFFFFFFF Foreground: #FF006400 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: HTML Tag Delimiter Background: #FFFFFFFF Foreground: #FF0000FF Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: HTML Element Name Background: #FFFFFFFF Foreground: #FF800000 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: String(C# @ Verbatim) Background: #FFFFFFFF Foreground: #FFA31515 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Comment Background: #FFFFFFFF Foreground: #FF008000 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Identifier Background: #FFFFFFFF Foreground: #FF000000 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Keyword Background: #FFFFFFFF Foreground: #FF0000FF Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Number Background: #FFFFFFFF Foreground: #FF000000 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Operator Background: #FFFFFFFF Foreground: #FF000000 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Preprocessor Keyword Background: #FFFFFFFF Foreground: #FF0000FF Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: String Background: #FFFFFFFF Foreground: #FFA31515 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Literal Background: #FFFFFFFF Foreground: #FF000000 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: XML Doc Comment Background: #FFFFFFFF Foreground: #FF008000 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: XML Doc Tag Background: #FFFFFFFF Foreground: #FF808080 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Collapsible Text (Collapsed) Background: Foreground: #FF808080 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: outlining.collapsehintadornment Background: #FFF6F7FA Foreground: #FFD7DDE8 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Indicator Margin Background: #FFE6E7E8 Foreground: Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Line Number Background: #FFFFFFFF Foreground: #FF2B91AF Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: outlining.square Background: #FFE2E2E2 Foreground: #FF555555 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: outlining.verticalrule Background: Foreground: #FFA5A5A5 Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Track Changes after save Background: #FF6CE26C Foreground: Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Track Changes before save Background: #FFFFEE62 Foreground: Bold: False [8/10/2012 1:42:05 PM] [Resolved Color Information] Name: Visible Whitespace Background: Foreground: #FF2B91AF Bold: False

    Change VS2012 theme to dark:

    [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Razor Code Background: #FF505050 Foreground: Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Plain Text Background: #FF1E1E1E Foreground: #FFDCDCDC Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: HTML Attribute Background: #FF1E1E1E Foreground: #FF9CDCFE Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: HTML Attribute Value Background: #FF1E1E1E Foreground: #FFC8C8C8 Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: HTML Server-Side Script Background: #FFFFFFB3 Foreground: #FF000000 Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: HTML Comment Background: #FF1E1E1E Foreground: #FF608B4E Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: HTML Tag Delimiter Background: #FF1E1E1E Foreground: #FF808080 Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: HTML Element Name Background: #FF1E1E1E Foreground: #FF569CD6 Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: String(C# @ Verbatim) Background: #FF1E1E1E Foreground: #FFD69D85 Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Comment Background: #FF1E1E1E Foreground: #FF608B4E Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Identifier Background: #FF1E1E1E Foreground: #FFFFFFFF Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Keyword Background: #FF1E1E1E Foreground: #FF569CD6 Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Number Background: #FF1E1E1E Foreground: #FFB5CEA8 Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Operator Background: #FF1E1E1E Foreground: #FFB4B4B4 Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Preprocessor Keyword Background: #FF1E1E1E Foreground: #FF9B9B9B Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: String Background: #FF1E1E1E Foreground: #FFD69D85 Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Literal Background: #FF1E1E1E Foreground: #FFDADADA Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: XML Doc Comment Background: #FF1E1E1E Foreground: #FF608B4E Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: XML Doc Tag Background: #FF1E1E1E Foreground: #FF608B4E Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Collapsible Text (Collapsed) Background: Foreground: #FF808080 Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: outlining.collapsehintadornment Background: #FF232323 Foreground: #FFD7DDE8 Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Indicator Margin Background: #FF333333 Foreground: Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Line Number Background: #FF1E1E1E Foreground: #FF2B91AF Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: outlining.square Background: #FF000000 Foreground: #FFE2E2E2 Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: outlining.verticalrule Background: Foreground: #FFA5A5A5 Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Track Changes after save Background: #FF577430 Foreground: Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Track Changes before save Background: #FFEFF284 Foreground: Bold: False [8/10/2012 1:42:41 PM] [Resolved Color Information] Name: Visible Whitespace Background: Foreground: #FF144852 Bold: False

    Change VS2012 theme to light:

    [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Razor Code Background: #FFE7EFF2 Foreground: Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Plain Text Background: #FFFFFFFF Foreground: #FF000000 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: HTML Attribute Background: #FF1E1E1E Foreground: #FFFF0000 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: HTML Attribute Value Background: #FF1E1E1E Foreground: #FF0000FF Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: HTML Server-Side Script Background: #FFFFFF00 Foreground: #FF000000 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: HTML Comment Background: #FF1E1E1E Foreground: #FF006400 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: HTML Tag Delimiter Background: #FF1E1E1E Foreground: #FF0000FF Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: HTML Element Name Background: #FF1E1E1E Foreground: #FF800000 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: String(C# @ Verbatim) Background: #FF1E1E1E Foreground: #FFA31515 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Comment Background: #FF1E1E1E Foreground: #FF008000 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Identifier Background: #FF1E1E1E Foreground: #FFDCDCDC Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Keyword Background: #FF1E1E1E Foreground: #FF0000FF Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Number Background: #FF1E1E1E Foreground: #FFDCDCDC Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Operator Background: #FF1E1E1E Foreground: #FFDCDCDC Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Preprocessor Keyword Background: #FF1E1E1E Foreground: #FF0000FF Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: String Background: #FF1E1E1E Foreground: #FFA31515 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Literal Background: #FF1E1E1E Foreground: #FFDCDCDC Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: XML Doc Comment Background: #FF1E1E1E Foreground: #FF008000 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: XML Doc Tag Background: #FF1E1E1E Foreground: #FF808080 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Collapsible Text (Collapsed) Background: Foreground: #FF808080 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: outlining.collapsehintadornment Background: #FFF6F7FA Foreground: #FFD7DDE8 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Indicator Margin Background: #FFE6E7E8 Foreground: Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Line Number Background: #FF1E1E1E Foreground: #FF2B91AF Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: outlining.square Background: #FFE2E2E2 Foreground: #FF555555 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: outlining.verticalrule Background: Foreground: #FFA5A5A5 Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Track Changes after save Background: #FF6CE26C Foreground: Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Track Changes before save Background: #FFFFEE62 Foreground: Bold: False [8/10/2012 1:43:33 PM] [Resolved Color Information] Name: Visible Whitespace Background: Foreground: #FF2B91AF Bold: False

    The second issue is that VS2012 is not firing the , IVsTextManagerEvents when fonts and colors / font size settings change as it did in previous versions of VS (2010). Here is some sample code:

    class Configuration : IVsTextManagerEvents {
      OnUserPreferencesChanged(VIEWPREFERENCES[] pViewPrefs, FRAMEPREFERENCES[] pFramePrefs, LANGPREFERENCES[] pLangPrefs, FONTCOLORPREFERENCES[] pColorPrefs) { 
        // update configuration... This is not called 
      }
    
            private void SubscribeToOptionChangedEvents()
            {
                var textManager = Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider.GetService(typeof(SVsTextManager)) as IVsTextManager2;
                var container = textManager as IConnectionPointContainer;
                if (container == null)
                    return; // never hit, when debugging this issue in 2012...
    
                Guid eventGuid = typeof(IVsTextManagerEvents).GUID;
                IConnectionPoint textManagerEventsConnection;
                container.FindConnectionPoint(ref eventGuid, out textManagerEventsConnection);
                uint cookie;
                textManagerEventsConnection.Advise(this, out cookie);
            }
    }

    The code above worked perfectly in previous versions of Visual Studio. Also, it is fired when you switch them colors, just not font settings (like before).. 

    EDIT:

    This appears to be broken in RC and fixed in RTM.. Can you confirm. http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/34efdc46-d0f0-4369-8549-75784297df43

    Also, is there a way to check when a theme changes so we can update our visual styles?


    -Blake Niemyjski (Software Development Engineer)




    Friday, August 10, 2012 6:50 PM
  • Hi,

    While a high-res image would help, I guess that you get the correct background color (almost black) for normal text but you get the wrong background color (white) for keywords, comments, etc. Is that correct?

    If so, I have found the same issue with VS 2012 and the dark theme. It is something that really started in VS 2010 and that I reported to no avail:

    VSIP: VS 2010 Dec LCTP: EnvDTE.FontsAndColorsItems.Item(textEditorItem).Background returns 0 instead of actual background color
    https://connect.microsoft.com/VisualStudio/feedback/details/518919

    In VS 2010 you get a black (0x000000) background instead the correct (white) background for items other than the regular text. In VS 2012 you get white background (0xFFFFFF) instead of the correct (almost black) background for items other than the regular text.

    I have a workaround that consists in using always the background of the regular text, even for keywords, comments, strings, etc. but of course it losses fidelity when the user selects a different background for those items and for the regular text.

    Some days ago I tried to use the SDK services rather than the DTE properties for font colors but the problem remained, so I don't know how VS is doing to get the correct results.

    Ryan: it happens when you start VS already with the dark theme, no theme changing involved here.


    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com. My blog about developing add-ins: http://msmvps.com/blogs/carlosq/


    Yeah, that really sucks and is an API limitation. I don't know why the ColorableItems class doesn't contain useful additional properties like default value etc..?  Also, if we are updating the API, why don't we add usefull information like this along with other properties that contain the color information (not as a uinit). It really sucks when you only have an uint with a value of 0 for the background/foreground color and you don't know if the property is editable (disabled in the ui) or if it's default / inherited or should be black..


    -Blake Niemyjski (Software Development Engineer)

    Friday, August 10, 2012 7:06 PM
  • Bump.

    -Blake Niemyjski (Software Development Engineer)

    Wednesday, August 15, 2012 1:41 PM
  • I wouldn't be able to confirm without either running your code on RTM or replicating all the non-trivial code you have, so it seems highly unlikely I would be able to do any sort of confirmation. If Ed says that the text manager events were fixed in RTM I believe him, I recall a mail he sent to some editor folks that I believe I was on where it pointed out the issue and pushed for it to be fixed, I believe it was fixed and he verified it was fixed.

    It also isn't clear in the giant text dump above which colors are incorrect. Just simply looking at say, the Razor background color, it appears to be at FFE7EFF2 in initial light, then change to FF505050 then back to FFE7EFF2. Are you claiming these colors are incorrect, plugging the hex values into Paint.NET appears to result in colors that look roughly right to me.

    Ryan

    Thursday, August 16, 2012 5:42 PM
    Moderator
  • Thanks for getting back to me Ryan. I was unable to edit the thread in chrome earlier today when I tried. I went back to IE and I can now reply..

    I've confirmed that the event now fires in RTM :).

    I just created a sample for you (windowscoding.com/invalidfontsandcolors.zip). I went a head and created a new VS Package project via 2012 RTM and then updated the package class logic only. I added debug print lines so you can verify (and step through) via the output window.

    The package will be loaded immediately once you start debugging and will output the default load color settings. Just change the theme from light to dark to light and look at the console. You can see that the settings are returned incorrectly. If you need anything more please let me know.

    EDIT: I noticed that the "colors returned correctly everytime" section may be incorrect as I just saw that razor code's foreground color was returned wrong but seems to be returned correctly sometimes??


    -Blake Niemyjski (Software Development Engineer)


    Thursday, August 16, 2012 6:33 PM
  • Where you able to download and run the sample?

    -Blake Niemyjski (Software Development Engineer)

    Friday, August 17, 2012 8:09 PM
  • I haven't had time to take a look. I am not actually a support person so this isn't my 'real job' in the sense that this isn't what Microsoft primarily pays me to do, so that means during the day the amount of time I can spend on this is constrained by the other number of things they have me working on. This isn't to say I *won't* look, but just that the speed at which I am able to get to it is likely to be slower than you would like.

    Ryan

    Friday, August 17, 2012 8:20 PM
    Moderator
  • Hello,

    Thanks for the clarification. I wish they would put this someplace so others would know :). While I'm waiting is their a place where users can submit this and get a guaranteed timely response?


    -Blake Niemyjski (Software Development Engineer)

    Friday, August 17, 2012 9:16 PM
  • Hello,

    Thanks for the clarification. I wish they would put this someplace so others would know :). While I'm waiting is their a place where users can submit this and get a guaranteed timely response?


    -Blake Niemyjski (Software Development Engineer)

    This is pretty blocking :-( and I hate to bother anyone.
    Thursday, August 23, 2012 2:37 PM
  • I will take a look today.

    As for 'other places', other than Connect, none that I am aware of.

    Personal (human to human, direct contact) support simply doesn't scale to the level of VS' user base.

    Microsoft has paid support options, but if we all spent time manning the forums / connect we would get nothing else done due to the massive amount of bugs files with unclear/no repro steps, unclear questions, misdirected questions, etc... 

    Well, actually if we ALL did it (and each person grabbed questions in their 'area of expertise'), I think we could keep up, but unfortunately hardly anyone internally seems interested in fielding questions here, why, I don't know.

    Ryan

    Friday, August 24, 2012 7:53 PM
    Moderator
  • Hey,

    It's been a few weeks and I was wondering if you found out anything?


    -Blake Niemyjski (Software Development Engineer)

    Thursday, September 06, 2012 5:31 PM
  • I sent it over to someone much more familar with this specific code path, as it is, suprisingly, non-trival and my debugging was going very slowly. I will ping him and see if he has had time to look at it yet.

    Ryan

    Thursday, September 06, 2012 5:36 PM
    Moderator
  • Did he ever get back to you? I'm starting to work on our themes for VS and would love to have this resolved.
    Tuesday, September 25, 2012 8:11 PM
  • The bug is sitting on his plate, how quickly he will get to it is impossible to tell as it is balanced against: planning for next release, other bugs, etc...

    Ryan

    Friday, September 28, 2012 5:51 PM
    Moderator
  • I have reproduced the problem (my add-in is also affected) and certainly it is related to switching from Dark to Light theme or viceversa (my first post was wrong).

    I have filed a bug at Microsoft Connect:

    EnvDTE.FontsAndColorsItems.Item("Keyword").Background not updated after changing theme
    https://connect.microsoft.com/VisualStudio/feedback/details/765401/envdte-fontsandcolorsitems-item-keyword-background-not-updated-after-changing-theme#details

    As a workaround, I am detecting if the backcolor of the "String", "Comment" and "Keyword" items is 0x1E1E1E for the Light theme or 0xFFFFFF for the Dark theme, and if so I use the backcolor of "Text Editor" which is returned correctly. It is far from perfect but better than using the wrong (opposite) backcolor color.



    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com. My blog about developing add-ins: http://msmvps.com/blogs/carlosq/

    Sunday, September 30, 2012 12:00 AM
    Moderator
  • I've thought about using a work around, but I'd rather not have to as it would then break people using custom themes. Also, if this was fixed in a patch, our customers would then have to download an updated msi from us  to remove this hack.  

    It's been 5+ weeks without a reply on connect on multiple issues (E.G., they broke some find API's as well)...


    -Blake Niemyjski (Software Development Engineer)

    Wednesday, October 03, 2012 8:47 PM
  • I've fixed the bug in the product.  Here's what I recommend as a workaround:

    1. Get the IVsFontAndColorStorage service and call OpenCategory with guid {A27B4E24-A735-4D1D-B8E7-9716E1E3D8E0} and flags __FCSTORAGEFLAGS.FCSF_LOADDEFAULTS | __FCSTORAGEFLAGS.FCSF_READONLY.

    2. Get the colors of the item you're interested in via the GetItem method.

    3. If the most-significant byte of the color values you got from GetItem is 0 (e.g. 0x00ffffff), you already have the literal RGB value in hand.

    4. Otherwise, if either of the color values is 0x01000000 or 0x01000001, that's a specially encoded value meaning "same as the 'plain text' foreground" or "same as the 'plain text' background", respectively.  In that case, you'll need to get the color of the "Plain Text" item and substitute that.  You can do this by opening a new category with the same guid and flags __FCSTORAGEFLAGS.FCSF_LOADDEFAULTS | __FCSTORAGEFLAGS.FCSF_NOAUTOCOLORS | __FCSTORAGEFLAGS.FCSF_READONLY, then calling GetItem on "Plain Text".

    5. Otherwise, a different encoding is at play and we don't need the workaround in step 4.  Re-open the category with FCSF_NOAUTOCOLORS as above, and call GetItem on the item again to get the non-encoded versions.

    6. Call CloseCategory (do this once for each call to OpenCategory to avoid memory leaks).

    -Josh

    Friday, October 05, 2012 11:27 PM
  • Hello Josh,

    Thank you so much for fixing this bug. Is there any eta, when this will be available as a product update / bug fix via windows update or in the Visual Studio updates window?

    Also, do you know if any ones looked into this breaking find issue: http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/713caa05-cba6-4deb-8b8c-dbd2f47053c5/#f80b9ccd-98ba-40f7-9d4b-fee58bfd0212 ? This is working in 2010, but broke in 2012 as well.

    Thanks again for your time!

    -Blake


    -Blake Niemyjski (Software Development Engineer)

    Monday, October 08, 2012 7:10 PM
  • The fix isn't scheduled to be included in an update, so it will be in the next release of VS.

    Thanks for letting me know about the find bug.  I'll find someone here who is familiar with the find dialog and ask them to respond.

    -Josh

    Tuesday, October 16, 2012 2:19 PM
  • When you say next release of VS, do you mean SP1 or VS2013/2014?

    Thank you so much for everything!


    -Blake Niemyjski (Software Development Engineer)

    Tuesday, October 16, 2012 3:35 PM
  • Sorry I wasn't clear.  I don't know whether there will be a service pack for VS 2012, so to the best of my current knowledge, this bugfix will go out in the next major release (VS2013/2014).

    -Josh

    Tuesday, October 16, 2012 5:51 PM
  • Hello,

    This is still an issue with VS2012 Update 1. Will this be fixed in 2012 Update 2?


    -Blake Niemyjski (Software Development Engineer)

    Monday, December 10, 2012 5:28 PM
  • As Josh said it will likely be the next release not an update or service pack. The bar for bug fixes getting into an update is fairly high and I don't think this bug meets that bar.

    Ryan

    Monday, December 10, 2012 7:51 PM
    Moderator
  • Hello,

    Is there any update on this issue? Is this fixed in Update2? http://blogs.msdn.com/b/bharry/archive/2013/01/30/announcing-visual-studio-2012-update-2-vs2012-2.aspx

    Wednesday, January 30, 2013 8:55 PM
  • This is not in Update 2. As Josh said originally it will likely only be in the next shipped version. As a developer I think every bug should be fixed/back ported, but that isn't how it works. Putting on my 'triage' hat for a moment (I am normally not involved in that process, but have sat in on it enough to understand the rough calculus):

    Q:  Is this bug a crashing bug or sometihng that severly hinders productivity?
    A:  No.

    Q:  Has there been large amounts of customer feedback regarding this issue?
    A:  No.

    Q:  Is there a work around?
    A:  Yes.

    These answers taken together basically means the fix is extremely unlikely to be back-ported as there is risk every time something like that is done, and the cost is generally fairly high.

    Thursday, January 31, 2013 6:02 PM
    Moderator
  • Hello,

    I wanted to let you know that this is still broken in 2013.


    -Blake Niemyjski (Software Development Engineer)

    Monday, August 12, 2013 1:57 PM
  • Here is a link to the issue: https://connect.microsoft.com/VisualStudio/feedback/details/518919#tabs

    -Blake Niemyjski (Software Development Engineer)

    Monday, August 12, 2013 1:58 PM
  • Thanks for your work around. It seems to be working great. I did find one crazy issue tho. It works in every scenario including VS 2010 / 2012 and 2013. But in 2012 if you start out with the light theme and switch to the dark, some of the colors are not converted properly. But if you go from dark to light or dark to blue it's fine. I'll try looking into this and getting more information once they resolve this issue: http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/73585b6f-b4f8-4be6-bb9d-2dee99a6c041/#0ff60891-b9d1-468f-9246-392ba341c6b4

    -Blake Niemyjski (Software Development Engineer)

    Tuesday, September 17, 2013 1:20 PM
  • You say this is still broken in 2013?  Can you provide more details?  I just tried this in a recent build of VS 2013 (an internal build, but similar to the RC build) and didn't see the problem using the repro project at http://windowscoding.com/invalidfontsandcolors.zip.  Are the repro steps different?

    Thanks,

    -Josh Stevens

    VS IDE team

    Tuesday, October 08, 2013 11:01 PM
  • I was able to get this resolved in every VS2010/12/13. But in 2012 if you start out with the light theme and switch to the dark, some of the colors are not converted properly. But if you go from dark to light or dark to blue it's fine. I used the 6 steps that were outlined on the 6th. Are you guys still fixing VS2012? If not, I won't bother creating a sample unless this has a chance of being fixed in update4.

    -Blake Niemyjski (Software Development Engineer)

    Friday, October 11, 2013 8:35 PM
  • Unfortunately this fix doesn't meet the bar for a VSUpdate release.

    -Josh

    Friday, October 11, 2013 8:39 PM