[VS11-VSIX] Extension never receives color change notifications
-
Samstag, 28. April 2012 23:42
The full project can be found at: http://vscoloroutput.codeplex.com.
I use the following code to register and respond to color change events in the Fonts and Colors dialog of Visual Studio. This code works in VS 2010 and not in VS 11 Beta
namespace BlueOnionSoftware { public class TextManagerEvents : IVsTextManagerEvents { private Guid _guidColorService = Guid.Empty; public static IVsTextManager2 Override; private static IVsTextManager2 GetService() { return Override ?? ServiceProvider.GlobalProvider.GetService(typeof(SVsTextManager)) as IVsTextManager2; } public static void RegisterForTextManagerEvents() { var textManager = GetService(); var container = textManager as IConnectionPointContainer; IConnectionPoint textManagerEventsConnection; var eventGuid = typeof(IVsTextManagerEvents).GUID; container.FindConnectionPoint(ref eventGuid, out textManagerEventsConnection); var textManagerEvents = new TextManagerEvents(); uint textManagerCookie; textManagerEventsConnection.Advise(textManagerEvents, out textManagerCookie); } public void OnRegisterMarkerType(int iMarkerType) { } public void OnRegisterView(IVsTextView pView) { } public void OnUnregisterView(IVsTextView pView) { } public void OnUserPreferencesChanged( VIEWPREFERENCES[] pViewPrefs, FRAMEPREFERENCES[] pFramePrefs, LANGPREFERENCES[] pLangPrefs, FONTCOLORPREFERENCES[] pColorPrefs) { if (pColorPrefs != null && pColorPrefs.Length > 0 && pColorPrefs[0].pColorTable != null) { var guidFontCategory = (Guid)Marshal.PtrToStructure(pColorPrefs[0].pguidFontCategory, typeof(Guid)); var guidColorService = (Guid)Marshal.PtrToStructure(pColorPrefs[0].pguidColorService, typeof(Guid)); if (_guidColorService == Guid.Empty) { _guidColorService = guidColorService; } if (guidFontCategory == DefGuidList.guidTextEditorFontCategory && _guidColorService == guidColorService) { FontAndColorStorage.UpdateColors(); } } } } }I logged the issue with VS 11 here. The response is odd on two counts.
- The response suggests that the OnUserPrefrencesChanged method is called. In my debugging sessions, this method is never called. To be clear, a break point on the first line of OnUserPreferencesChanged is never hit.
- The part about the GUID makes even less sense. The GUID listed doesn't exist.
I asked for clarification but never received a response.
Could someone please look at this issue and help me understand the response I've received? I'm having difficulty believing this behavior is by design.
- Bearbeitet Mike Ward - Ann Arbor Samstag, 28. April 2012 23:44 clarify
Alle Antworten
-
Montag, 30. April 2012 07:25Moderator
Hi Mike,
Thank you for your question.
I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
Thank you for your understanding and support.
Lucy Liu [MSFT]
MSDN Community Support | Feedback to us
-
Montag, 30. April 2012 12:16Thanks for your attention in this matter.
-
Freitag, 25. Mai 2012 17:36Moderator
Hi Mike,
Haven't a clue about that response to the connect bug. I have a hard time believing it's by design. This is a breaking change, and if they interface was absolete they should have failed the intial Advise call.
I've got a simple addin in Dev11 that repro's this behavior, and I've entered a new bug directly into the dev teams bug db. Will post back here as soon as I get confirmation one way or the other.
Sincerely,
Ed Dore
-
Freitag, 25. Mai 2012 17:39Awesome... and thanks for sticking with this.
-
Freitag, 25. Mai 2012 18:42
Hi Mike,
I apologize for the delay in responding back to your Connect issue and not providing a clear answer. What is the GUID you are trying to use?
Thanks,
Cathy Sullivan
Program Manager, Visual Studio Pro Experience Team
http://blogs.msdn.com/b/visualstudio -
Freitag, 25. Mai 2012 18:54
If you go back to the original report in the other forum, you'll notice that the GUID you provided is totally incorrect. But it's really beside the point. The problem is the notifications do not fire, not that the wrong GUID is used. I suggest we just drop the whole issue with GUIDS since it's just adding confusion at this point.
Fortunately, this has been reproduced now and will get corrected in a future release. (see Ed Dore's reply)
-
Dienstag, 12. Juni 2012 17:01Moderator
Hi Mike,
Just a quick follow up on this. Cathy's team did approved the fix, but it didn't get in before the RC release. But we have an interim drop that where we were able to confirm the OnUserPreferencesChanged now gets invoked (per the behavior you had with VS 2010).
Sincerely,
Ed Dore
- Als Antwort markiert Ed DoreMicrosoft Employee, Moderator Dienstag, 12. Juni 2012 17:02
-
Dienstag, 12. Juni 2012 17:10Awesome guys! Will this fix be publicly available before the final release?
-
Donnerstag, 14. Juni 2012 15:21Moderator
Hi Mike,
Unfortunately, I don't have any info around this. As far as I am aware the RC will be the last release before RTM.
Ed....
Ed Dore

