File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 33using System . Linq ;
44using System . Runtime . InteropServices ;
55using System . Threading . Tasks ;
6+ using Microsoft . Internal . VisualStudio . PlatformUI ;
67using Microsoft . VisualStudio ;
78using Microsoft . VisualStudio . Shell ;
89using Microsoft . VisualStudio . Shell . Interop ;
@@ -24,6 +25,12 @@ internal Solutions()
2425 public async Task < Solution ? > GetCurrentSolutionAsync ( )
2526 {
2627 await ThreadHelper . JoinableTaskFactory . SwitchToMainThreadAsync ( ) ;
28+
29+ if ( ! HierarchyUtilities . IsSolutionOpen )
30+ {
31+ return null ;
32+ }
33+
2734 IVsHierarchy solution = ( IVsHierarchy ) await VS . Services . GetSolutionAsync ( ) ;
2835 IVsHierarchyItem hierItem = await solution . ToHierarchyItemAsync ( VSConstants . VSITEMID_ROOT ) ;
2936 return SolutionItem . FromHierarchyItem ( hierItem ) as Solution ;
You can’t perform that action at this time.
0 commit comments