BUG: DTE.ActiveSolutionProjects property causes COMException if Solution Explorer is not shown and no solution loaded - by Carlos J. Quintero

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 735835 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 4/6/2012 4:44:15 PM
Access Restriction Public


The EnvDTE.DTE.ActiveSolutionProjects property causes a COMException in Visual Studio 11 Beta when the following two conditions are met:

1) The Solution Explorer toolwindow has not been shown.
2) No solution is loaded

It didn't happen in Visual Studio 2005/2008. 

Visual Studio 2010 has its own bug but somewhat different: only condition #1 is required. I reported it separately:

Sign in to post a comment.
Posted by Microsoft on 4/10/2012 at 1:55 PM
Agreed that ideally we would return an empty array instead of throwing an exception. However since there is a workaround of calling DTE.Solution.IsOpen before calling DTE.ActiveSolutionProjects, this bug falls below the bar with respect to the other remaining work items we have for VS11. Thus we will not be able to fix this in VS11.
Posted by Carlos J. Quintero on 4/9/2012 at 10:48 PM

While I agree that add-ins should check DTE.Solution.IsOpen before calling DTE.ActiveSolutionProjects (or maybe not, the check could be done in the DTE.ActiveSolutionProjects property and save all add-ins in the world that check), this is a bug because it breaks backwards compatibility: in VS 2008 it didn't happen, and therefore it breaks add-ins relying on the behavior of NOT checking DTE.Solution.IsOpen before calling DTE.ActiveSolutionProjects and instead assuming that DTE.ActiveSolutionProjects would return an empty array if there is no solution loaded.
Posted by Microsoft on 4/9/2012 at 5:43 PM
Thanks for your feedback. So from your description, it seems that when a solution is loaded and the Solution Explorer is not open, DTE.ActiveSolutionProjects property still returns a valid value. However, when in addition to the Solution Explorer being closed and there being no solution loaded, an exception happens. Is this correct? If so, could you elaborate on why you need to use this DTE API when there are no solutions active?
Posted by MS-Moderator08 [Feedback Moderator] on 4/9/2012 at 12:53 AM
Thank you for submitting feedback on Visual Studio 11 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.

Posted by MS-Moderator01 on 4/8/2012 at 7:00 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)