Can someone explain the usage of IVsRunningDocumentTable.RegisterAndLockDocument? RRS feed

  • Question

  • Hi all,

    Once my project files processed using this function,We pass the Edit Lock and it get result as S_OK. However, the files were not able to be opened from menu “File->Open…” any more.

    If we comment out this API, it works well.

    So can someone explain the usage for details? Is there any way to keep all other functionality expect “lock”, I mean only RegisterDocument without Lock, so that we can view it?

    Thanks in advance.



    MSC on Computer Science (Parallel algorithm)

    Thursday, May 23, 2013 4:35 AM

All replies

  • Are you opening the files in the IDE? If not you should not be placing them in the RDT. The RDT is a centralized place to locate info on opened files, if your file is not physically visible to the user it is likely you should not be placing it in the RDT. The error is probably because the editor that is trying to open it finds it open in the RDT but doesn't recognize the doc data as one of its own, so it fails.
    Thursday, May 23, 2013 2:32 PM
  • Thanks Ryan.

    Yes we are opening the files in the IDE.

    Suppose a file which we already link it to the solution explorer, we can open the file from solution explorer without any issue, but it will pop above error message when we open it via file/open.

    If I open a file which is not in the solution explorer from file/open, it works also well.

    Do you suggest we should unlock the file first and to open it via file/open? and How?



    MSC on Computer Science (Parallel algorithm)

    Monday, May 27, 2013 5:42 AM
  • Hi,

    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.

    Best regards,

    Ego [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, May 28, 2013 8:45 AM
  • You would need to supply a repro, alternatively you could debug and set the debugger to break on first chance exceptions. From the message it sounds like a managed exception was probably thrown, you should find out who is throwing it, as a first step.
    Tuesday, May 28, 2013 3:39 PM