locked
Is EnvDTE.DTE thread safe? RRS feed

  • Question

  • Hi,

    Is EnvDTE.DTE thread safe? I'm accessing the solution and project data from another thread using dte.Solution.Projects and want to be sure it isn't going to cause problems.

    note: by 'another thread' I mean a different thread from the solution/project changed callbacks that I get from the package.

    thanks,

    Stewart.


    Thursday, August 21, 2014 12:25 PM

Answers

  • Hi,

    EnvDTE.DTE is the root com based interface in Visual Studio Automation Object Model. It does not garantee the thread-safety for all the automation objects. If you check the MSDN documents of the VS Automation Object Model, you'll find this at the bottom of the page:

    Thread Safety

    Any public static (Shared in Visual Basic) members of this type are   thread safe. Any instance members are not guaranteed to be thread safe.

    To call it in multi-threaded application, this article should be helpful to you:

    Interacting with DTE2 COM interfaces from within a multithreaded application


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, August 22, 2014 4:07 AM