22using  System . Linq ; 
33using  FineCodeCoverage ; 
44using  System . Diagnostics ; 
5- using  Microsoft . VisualStudio ; 
65using  System . Collections . Generic ; 
76using  Microsoft . VisualStudio . Shell ; 
87using  System . Diagnostics . CodeAnalysis ; 
98using  Microsoft . VisualStudio . Shell . Interop ; 
109using  System . ComponentModel . Composition ; 
1110using  Microsoft ; 
12- using  EnvDTE ; 
11+ using  Task  =  System . Threading . Tasks . Task ; 
12+ using  EnvDTE80 ; 
1313
1414interface  IShowFCCOutputPane 
1515{ 
16-     System . Threading . Tasks . Task  ShowAsync ( ) ; 
16+     Task  ShowAsync ( ) ; 
1717} 
1818[ Export ( typeof ( IShowFCCOutputPane ) ) ] 
1919[ Export ( typeof ( ILogger ) ) ] 
2020public  class  Logger  :  ILogger ,  IShowFCCOutputPane 
2121{ 
2222    private  IVsOutputWindowPane  _pane ; 
2323    private  IVsOutputWindow  _outputWindow ; 
24-     private  DTE  dte ; 
24+     private  DTE2  dte ; 
2525    private  readonly  IServiceProvider  _serviceProvider ; 
2626    private  Guid  fccPaneGuid  =  Guid . Parse ( "3B3C775A-0050-445D-9022-0230957805B2" ) ; 
2727
@@ -35,33 +35,27 @@ IServiceProvider serviceProvider
3535        staticLogger  =  this ; 
3636    } 
3737
38-     IVsOutputWindowPane  CreatePane ( Guid  paneGuid ,  string  title , 
39-         bool  visible ,  bool  clearWithSolution ) 
40-     { 
41-         
42-         ThreadHelper . ThrowIfNotOnUIThread ( ) ; 
43-         _outputWindow  =  ( IVsOutputWindow ) _serviceProvider . GetService ( typeof ( SVsOutputWindow ) ) ; 
44-         Assumes . Present ( _outputWindow ) ; 
45-         dte  =  ( EnvDTE . DTE ) _serviceProvider . GetService ( typeof ( EnvDTE . DTE ) ) ; 
46-         Assumes . Present ( dte ) ; 
47- 
48-         // Create a new pane. 
49-         _outputWindow . CreatePane ( 
50-             ref  paneGuid , 
51-             title , 
52-             Convert . ToInt32 ( visible ) , 
53-             Convert . ToInt32 ( clearWithSolution ) ) ; 
54- 
55-         // Retrieve the new pane. 
56-         _outputWindow . GetPane ( ref  paneGuid ,  out  IVsOutputWindowPane  pane ) ; 
57-         return  pane ; 
58-     } 
59- 
6038    private  void  SetPane ( ) 
6139    { 
62-         ThreadHelper . ThrowIfNotOnUIThread ( ) ; 
63-         // do not clear with solution otherwise will not get initialize methods 
64-         _pane  =  CreatePane ( fccPaneGuid ,  "FCC" ,  true ,  false ) ; 
40+         ThreadHelper . JoinableTaskFactory . Run ( async  ( )  => 
41+         { 
42+             await  ThreadHelper . JoinableTaskFactory . SwitchToMainThreadAsync ( ) ; 
43+             _outputWindow  =  ( IVsOutputWindow ) _serviceProvider . GetService ( typeof ( SVsOutputWindow ) ) ; 
44+             Assumes . Present ( _outputWindow ) ; 
45+             dte  =  ( DTE2 ) _serviceProvider . GetService ( typeof ( EnvDTE . DTE ) ) ; 
46+             Assumes . Present ( dte ) ; 
47+ 
48+             // Create a new pane. 
49+             _outputWindow . CreatePane ( 
50+                 ref  fccPaneGuid , 
51+                 "FCC" , 
52+                 Convert . ToInt32 ( true ) , 
53+                 Convert . ToInt32 ( false ) ) ;  // do not clear with solution otherwise will not get initialize methods 
54+ 
55+             // Retrieve the new pane. 
56+             _outputWindow . GetPane ( ref  fccPaneGuid ,  out  IVsOutputWindowPane  pane ) ; 
57+             _pane  =  pane ; 
58+         } ) ; 
6559    } 
6660
6761    [ SuppressMessage ( "Usage" ,  "VSTHRD102:Implement internal logic asynchronously" ) ] 
@@ -154,7 +148,7 @@ public void LogWithoutTitle(IEnumerable<string> message)
154148        LogImpl ( message . ToArray ( ) ,  false ) ; 
155149    } 
156150
157-     public  async  System . Threading . Tasks . Task  ShowAsync ( ) 
151+     public  async  Task  ShowAsync ( ) 
158152    { 
159153        await  ThreadHelper . JoinableTaskFactory . SwitchToMainThreadAsync ( ) ; 
160154
0 commit comments