There was a bug filed against Chutzpah reporting that Chutzpah’s Visual Studio extension was causing database connection error popup. I was surprised by this since all Chutzpah really does is traverse the project hierarchy and I wasn’t sure how this could result in that error. After digging in and searching online a bit I found the issue. The act of traversing a node in the IVsHierarchy can cause arbitrary side affects (like establishing a database connection!). In order to determine if this can happen you must check the __VSHPROPID.VSHPROPID_HasEnumerationSideEffects
property on an IVsHierarchy item. Once I found this the fix was simple, just skip any node that has that property set.
One thought on “Avoiding side effects when traversing an IVsHierarchy in Visual Studio”
Comments are closed.
Thanks for posting this. I believe I just ran across this issue in another extension that I was using. “Filed a bug” with it. See https://visualstudiogallery.msdn.microsoft.com/8e1b4368-4afb-467a-bc13-9650572db708/view/Discussions