Custom text markers in VS2005 beta 2

Hi All,
We have a weird problem with custom text markers under VS2005 Beta 2 (8.0.50215.44).
<br>
Our AddIn registers about 30 custom text marker types. We tested it under
VS2005 and, seemingly randomly, some of them work and some do not. What
happens is that markers do appear in the editor (tooltips are showing, for
example), but they have wrong colors
(not what our implementation of IVsPackageDefinedTextMarkerType says they
should have)
<br>
We investigated this problem, and this is what we have found so far:
<br>
1. When we remove all registered external markers (all entries from 'VisualStudion\Text Editor\External Markers' key) besides our markers, they all start to work.
<br>
2. If we register more marker types then, after some point, the markers with higher GUIDs do not work. It seems to be that only first 30 markers (in GUID order) registered under 'VisualStudion\Text Editor\External Markers' work.
<br>
Does anyone have any ideas on this
<br>
Friendly,
Dmitry


Answer this question

Custom text markers in VS2005 beta 2

  • Mohan1

    Hi Ed,

    is there any news on this issue Thanks.

    Dmitry


  • BoshBuy

    This does appear to be an issue with VS 2005.  I am currently investigating if there are any workarounds and I'll let you know if there are.  We will not be able to fix this issue before we ship VS 2005 however.

    Thanks,

    Dylan

  • Koogel

    Hi Dylan,

    thank you a lot for your investigation & explanation. In any case, it is important for us to know what is the source of the problem.

    I'm afraid it is difficult for us not to use different colors, as our product provides a feature that colors every C# construct (methods, types, events, properties etc) in different way. But since this is not the primary feature of the product, we'll consider dropping it for the version for VS 2005. Also, thanks for your proposal of dynamically changing glyph image and text - we register a lot of different markers for just showing glyph images, and there's something we definitely need to think of.

    Regards,
    Dmitry


  • ronnoc

    No. Could you please clarify how does this relate to the problem
    We show icons on the left gutter for some our custom marker types, but it looks like the problem reproduces regardless of the properties of marker types in question - only their total number matters.

  • DC3Dreamer

    Update: I realized that is hardly possible to dynamically change glyph colors, as the glyph is drawn in the IVsPackageDefinedMarkerType.DrawGlyphWithColors method which does not take the marker as a parameter. Hence it is impossible to figure out in this method which glyph to draw depending on the marker
  • KDR2006

    In your markers, are you creating any dynamic context menus
  • Witold

    Dmitry,

    Couldn't you keep an internal data member specifiying which "marker type" the marker actually is   The DrawGlyphWithColors call is being called on the marker itself.

    You could also do this with subclasses as well.

    Thanks,

    Dylan

  • johnedgar

    I was able to create a small package targeting Whidbey Beta2 that I think reproduces the problem. It's just a small package that registers and implements 35 custom glyph markers.

    I'm seeing an ArgumentException being thrown when I call IVsTextManager.GetRegisteredMarkerTypeID. Let me know if you're seeing a similar problem. I'll try to track this down next week. A preliminary search of the bug database didn't show this to be a known issue.

    Sincerely,
    Ed Dore [MSFT]

  • MelissaA

    I've discovered the issue, but unfortunately there is no workaround.  This most likely won't get fixed as we've locked down on VS 2005.

    For those interested, here is a description of the problem.  We overlay the marker information onto lines of text.  The marker information is stored as part of an "attribute" on the text.  This attribute contains other information as well.  We have a bit mask to specify which portions of the attribute are for what information.  Here is where we run into the problem.  We allocate six bits to the marker information.  This means we can count up to 63 (For a total of 64 markers 0-63).  There are 34 internal VS markers, so if there are 30 external markers, we overflow and any marker registered after the 29th external marker will roll over.  The sort is done based on GUID, so you can visually tell by looking at the registry which markers will not color properly.  Since the value rolls over, the editor gets a valid marker ID and uses that color.



  • Guy69

    I should add that Ed brought up a good point in an email thread with me.  If you don't need markers to have different colors, you could just register one external marker that would dynamically change text and the glyph image.

    Please let me know if you have any questions about this.

    Thanks,

    Dylan

  • Andy Ho

    So does anybody else encounter this issue Can anyone from MS confirm if this is a problem

    May be we should prepare a small sample illustrating it, though it will definitely require some work. Basically, we may create a package which registers >30 custom text marker types and see if all of them will work properly. But if this is a known issue, we would like to avoid wasting time to create a repro :) 


  • xzlc5188

    Dylan,

    I was about to suggest the same thing. Just fo the sake of this discussion, here's an example. I register a single marker that is capable of showing 20 different images depending on the command invoked by the user. Images are handed over to the marker, i.e. it doesn't actually have all 20 of them defined.


  • Ahmed Abbas

    Hi Sergey,

    that's fine but what about glyph images shown on the left gutter The function which draws them belongs to the marker type and doesn't actually know for what marker the image is currently drawn (see also my post below)

  • E-Shy

    I was trying to figure this out also. I had taken the same steps as Dmitry, so I can confirm that only the first 30 GUIDs for text markers actually work. I also took about half from their addin and about half from VS totaling 30 and they all worked correctly. Adding one more caused seemingly random coloring errors.

    This happens in Beta 2 versions up to July CTP.

  • Custom text markers in VS2005 beta 2