||Carlos J. Quintero (Microsoft MVP)
||Microsoft Visual Studio 2005
When using a macro or add-in in VS 2005 to capture the
EnvDTE.SolutionEvents.BeforeClosing event of the extensibility model, the event
is raised even when there is no solution loaded (and therefore there is no
solution being closed).
This is a bug of Visual Studio 2005.
Steps to reproduce the problem:
- Open the Macros IDE, go to the EnvironmentEvents file and add this code:
Sub SolutionEvents_AfterClosing() Handles SolutionEvents.AfterClosing
Private Sub SolutionEvents_BeforeClosing() Handles SolutionEvents.BeforeClosing
If DTE.Solution.IsOpen Then
MsgBox("BUG: there is no solution open to launch the BeforeClosing event")
- Go back to the main IDE and close the current loaded solution (if
any). Load a solution from the Recent Projects menu. You get a
SolutionEvents_BeforeClosing event when no solution was open, and therefore
there is no solution to be closed. The event should not be raised in this
case. This did not happen In VS.NET 2003.
Go back to the 'Resources for Visual Studio .NET extensibility' section for more articles like this