Hi there,
I want to unload and re-load a project within a Visual Studio package. The solution is open and I listens to the OnAfterRenameProject event. In this event I wrote the following few lines of C# code:
IVsHierarchy selectedHierarchy; Solution.GetProjectOfUniqueName(project.UniqueName, out selectedHierarchy); Solution.CloseSolutionElement((uint)__VSSLNCLOSEOPTIONS.SLNCLOSEOPT_UnloadProject, selectedHierarchy, 0);
When the CloseSolutionElement method is invoked, I get a AccessViolation:
A first chance exception of type 'System.AccessViolationException' occurred in Microsoft.VisualStudio.Shell.TreeNavigation.HierarchyProvider.dllAdditional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
The problem is that I have no clue why this happens. I remember it worked 1-2 times but then *boom*. No chance to get it working again.
Maybe someone can provide some thoughts about this?
Bye,
Fabian
The Visual Studio Settings-Switcher! Visit http://visualstudiogallery.msdn.microsoft.com/a79072f7-3109-44a0-95c0-9c50e729d6a3