locked
Visual Studio 2008 hangs when I invoke anything on IVsTextBuffer when "Find in files" is in progress RRS feed

  • Question

  • I am registering IVsTextLinesEvents event listener on IVsTextLines text buffers. In the OnChangeLineText() method, I am querying the buffer for its language service, so that I can add custom markers to comments, whenever I am in C# or VB.

    The problem is, whenever the "Find in files" operation is invoked, the OnChangeLineText() gets invoked and the query for language service hangs the whole Visual Studio, as if there was a deadlock somewhere in the IVsTextLines objects:

     Guid languageServiceId;
     textLines.GetLanguageServiceID(out languageServiceId); <-- this line hangs
    

    I have tried a workaround of querying for the file name instead of language service, but in this case, the cast operation hangs:

    object oname;
    Guid guidVsBufferMoniker = typeof(IVsUserData).GUID;
    IVsUserData ud = (IVsUserData)textLines;                       <-- this line hangs
    int hr = ud.GetData(ref guidVsBufferMoniker, out oname);
    

    I have managed to find a workaround - I am determining a buffer's language in another place, that appears deadlock safe, but it forces me to keep some state data and makes the code somewhat complicated.

    I have filed it as a bug in our bugtracking system: https://studio.atlassian.com/browse/PLVS-139

    Anyway, is this a known issue?

    Regards
    Janusz

    Friday, March 5, 2010 12:06 PM

All replies

  • Hi Janusz,

    It seems we can't call back into the text buffer from the implementation of IVsTextLinesEvents, I'm not sure what's the exact rule in this specific scenario.  I suggest you posting this to our connect site:
    https://connect.microsoft.com/VisualStudio
    So the product unit can take a note of it, diagnose it and show us the details in it.
    Currently, I'm afraid that operating the text buffer beyond the implementation of IVsTextLinesEvents is the only way.

    Sorry for cannot help more.

    Sincerely,
    Wesley Yao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact: msdnmg @ microsoft.com
    Please mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, March 8, 2010 9:59 AM
  • Well, bummer that :( - but as I found a workaround, this is not a blocker for me
    Monday, March 8, 2010 2:35 PM