BUG: DTE.ActiveSolutionProjects property causes COMException if Solution Explorer is not shown.

Author: Carlos J. Quintero (Microsoft MVP) Applies to: Microsoft Visual Studio 2010
Date: April  2012    

This article shows a bug of the EnvDTE.DTE.ActiveSolutionProjects property that happens in Visual Studio 2010 when the Solution Explorer toolwindow has not been shown. It didn't happen in Visual Studio 2005/2008.

More information

Steps to reproduce the problem:

  • Open Visual Studio 2010.
  • If the Solution Explorer toolwindow is shown, close it and then close Visual Studio 2010 and open it again.
  • Create and run the following macro. You get the following exception: "System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component."
Language: VB.NET   Copy Code Copy Code (IE only)
    Sub Macro1()


            If DTE.ActiveSolutionProjects Is Nothing Then

            End If

        Catch ex As System.Exception


        End Try

    End Sub

Go to the 'Visual Studio Extensibility (VSX)' web site for more articles like this (Articles section)