@@ -36,33 +36,27 @@ IServiceProvider serviceProvider
3636 staticLogger = this ;
3737 }
3838
39- IVsOutputWindowPane CreatePane ( Guid paneGuid , string title ,
40- bool visible , bool clearWithSolution )
41- {
42-
43- ThreadHelper . ThrowIfNotOnUIThread ( ) ;
44- _outputWindow = ( IVsOutputWindow ) _serviceProvider . GetService ( typeof ( SVsOutputWindow ) ) ;
45- Assumes . Present ( _outputWindow ) ;
46- dte = ( EnvDTE . DTE ) _serviceProvider . GetService ( typeof ( EnvDTE . DTE ) ) ;
47- Assumes . Present ( dte ) ;
48-
49- // Create a new pane.
50- _outputWindow . CreatePane (
51- ref paneGuid ,
52- title ,
53- Convert . ToInt32 ( visible ) ,
54- Convert . ToInt32 ( clearWithSolution ) ) ;
55-
56- // Retrieve the new pane.
57- _outputWindow . GetPane ( ref paneGuid , out IVsOutputWindowPane pane ) ;
58- return pane ;
59- }
60-
6139 private void SetPane ( )
6240 {
63- ThreadHelper . ThrowIfNotOnUIThread ( ) ;
64- // do not clear with solution otherwise will not get initialize methods
65- _pane = CreatePane ( fccPaneGuid , "FCC" , true , false ) ;
41+ ThreadHelper . JoinableTaskFactory . Run ( async ( ) =>
42+ {
43+ await ThreadHelper . JoinableTaskFactory . SwitchToMainThreadAsync ( ) ;
44+ _outputWindow = ( IVsOutputWindow ) _serviceProvider . GetService ( typeof ( SVsOutputWindow ) ) ;
45+ Assumes . Present ( _outputWindow ) ;
46+ dte = ( EnvDTE . DTE ) _serviceProvider . GetService ( typeof ( EnvDTE . DTE ) ) ;
47+ Assumes . Present ( dte ) ;
48+
49+ // Create a new pane.
50+ _outputWindow . CreatePane (
51+ ref fccPaneGuid ,
52+ "FCC" ,
53+ Convert . ToInt32 ( true ) ,
54+ Convert . ToInt32 ( false ) ) ; // do not clear with solution otherwise will not get initialize methods
55+
56+ // Retrieve the new pane.
57+ _outputWindow . GetPane ( ref fccPaneGuid , out IVsOutputWindowPane pane ) ;
58+ _pane = pane ;
59+ } ) ;
6660 }
6761
6862 [ SuppressMessage ( "Usage" , "VSTHRD102:Implement internal logic asynchronously" ) ]
0 commit comments