Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
|
I'll let Edhy reply, too, but I believe it did resolve his issues. The root cause was that almost every AddIn/VSPackage has to use the EnvDTE Solution/Project/ProjectItem collection of interfaces to interact with the project system of Visual Studio. VS is written in I'm guessing C++, and exposes the object model through COM objects by way of those interfaces. The COM objects can be accessed from any thread without error until one thread takes explicit ownership of the object. The partial classes are built on a background thread so the UI thread is not blocked. VS does not appear to force the main thread to take ownership of any of the COM objects, so the background thread in the BOMapper can still access them. However, it appears that something in CodeRush or other DevExpress component does force the main thread to take ownership, so as soon as they are accessed in the BOMapper, VS crashes because the AccessViolationException cannot be caught and VS just dies. With Edhy's debugging help, I wrapped all of the access to the COM objects in calls to Dispatcher.Invoke() so they are all accessed from the main UI thread. This is a good case study in one AddIn not knowing what the other is doing.
|