Ver versión en español    
 
Home
10 Reasons to use MZ-Tools
MZ-Tools 6.0 for VS.NET
Editions
Features
Online Documentation
MZ-Tools SDK
Download
Purchase
Version History (RSS)  
FAQ & Support
MZ-Tools 3.0 for VB6 & VBA
Features
Online Documentation
Download (freeware)
Donations (Paypal)
Version History (RSS)  
FAQ & Support
User Reviews
Community Place
Contact  
For Add-In Developers
About
   
 
User Testimonials

I'm an avid supporter of MZ-Tools. It's a product I couldn't do without and your level of support is outstanding.

Jan Hyde (Visual Basic MVP)

You will soon wonder how you ever lived without it.

Andy Maggs

More user reviews
 
BUG: SolutionEvents.BeforeClosing event raised with no solution loaded in Visual Studio 2005 add-ins

Author: Carlos J. Quintero (Microsoft MVP) Applies to: Microsoft Visual Studio 2005
Date: February 2007    
       
Introduction

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).

Cause

This is a bug of Visual Studio 2005.

More Information

Steps to reproduce the problem:

  • Open the Macros IDE, go to the EnvironmentEvents file and add this code:
    Sub SolutionEvents_AfterClosing() Handles SolutionEvents.AfterClosing
       MsgBox("SolutionEvents_AfterClosing")
    End Sub
    Private Sub SolutionEvents_BeforeClosing() Handles SolutionEvents.BeforeClosing
       If DTE.Solution.IsOpen Then
          MsgBox("SolutionEvents_BeforeClosing")
       Else
          MsgBox("BUG: there is no solution open to launch the BeforeClosing event")
       End If
    End Sub
  • 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

MZ-Tools 6.0 for Visual Studio .NET

You can code, design, locate code and document your apps much faster using VB.NET, C#, C++ or Visual J#:

Buy MZ-Tools Now Download MZ-Tools Demo

   Top