locked
Sometimes files are opened in duplicate tabs RRS feed

  • Question

  • Hi,

    I have some strange behavior in my custom languageservice (VS2012/2013 with MPF).

    Sometimes (rarely, and impossible to deterministically reproduce until now) when the user double clicks a file which is already opened in the solution explorer, it opens in a separate tab instead of just activating the already existing one. As a consequence, there are two tabs representing the same file: Both show the same changes, and if you save/change one, the other gets saved/updated as well.

    Has anyone observed something similar? Or has anyone an idea what to do about it or where the problem could be? I tried to implement a workaround in the Dte.Events.WindowEvents.WindowCreated event by manually closing the duplicate and activating the original, but those methods (Window.Close() and Window.Activate()) cannot be called within an event handler.

    Regards & Thanks in advance,
    Markus

    Friday, May 1, 2015 8:08 PM

Answers

  • If you've got a custom project type implemented with the MPF_Proj codebase, that's all custom code. MPF_Proj is basically an example that a lot of people build off of to implement their own project types.

    About the only thing I can think of is to go back and maybe instrument the project type so that when you see the editor invoked, you could first check the RDT for the document, and if found, throw an exception and grab a crash dump for further analysis.

    Sincerely,


    Ed Dore

    • Marked as answer by Caillen Sunday, May 10, 2015 12:08 PM
    Monday, May 4, 2015 3:58 AM

All replies

  • Hi Markus,

    I don't think the language service has anything to do with this, as the language service isn't really responsible for the editor launch. What sort of project type is involved here? When you dblclick on a file in the Solution Explorer, the solution explorer toolwindow sends the project a UIHWCMDID_DoubleClick command. From there, the custom project takes over.

    Ed....


    Ed Dore

    Friday, May 1, 2015 10:36 PM
  • Hi Ed,

    my project is a Visual Studio Package project using MPF. I agree that the languageservice might not be reponsible for the same reason you describe.

    The double-click event is received by MPF.HierarchyNode.ExecCommand, and passed down several other MPF calls - none of which involves custom moethods/code - until it finally arrives at my own WindowCreated-handler for monitoring.

    I'm afraid without being able to reliably reproduce the issue there's little I can do about it. I just hoped that somebody had similar problems and knows a way to solve them.

    Regards,
    Markus

    Friday, May 1, 2015 11:36 PM
  • If you've got a custom project type implemented with the MPF_Proj codebase, that's all custom code. MPF_Proj is basically an example that a lot of people build off of to implement their own project types.

    About the only thing I can think of is to go back and maybe instrument the project type so that when you see the editor invoked, you could first check the RDT for the document, and if found, throw an exception and grab a crash dump for further analysis.

    Sincerely,


    Ed Dore

    • Marked as answer by Caillen Sunday, May 10, 2015 12:08 PM
    Monday, May 4, 2015 3:58 AM