File tree Expand file tree Collapse file tree 1 file changed +18
-23
lines changed
src/PowerShellEditorServices/Services/PowerShell/Execution Expand file tree Collapse file tree 1 file changed +18
-23
lines changed Original file line number Diff line number Diff line change @@ -55,10 +55,7 @@ public TResult Result
5555 throw new OperationCanceledException ( ) ;
5656 }
5757
58- if ( _exceptionInfo is not null )
59- {
60- _exceptionInfo . Throw ( ) ;
61- }
58+ _exceptionInfo ? . Throw ( ) ;
6259
6360 return _result ;
6461 }
@@ -79,27 +76,25 @@ public void ExecuteSynchronously(CancellationToken executorCancellationToken)
7976 return ;
8077 }
8178
82- using ( var cancellationSource = CancellationTokenSource . CreateLinkedTokenSource ( _taskRequesterCancellationToken , executorCancellationToken ) )
79+ using var cancellationSource = CancellationTokenSource . CreateLinkedTokenSource ( _taskRequesterCancellationToken , executorCancellationToken ) ;
80+ if ( cancellationSource . IsCancellationRequested )
8381 {
84- if ( cancellationSource . IsCancellationRequested )
85- {
86- SetCanceled ( ) ;
87- return ;
88- }
82+ SetCanceled ( ) ;
83+ return ;
84+ }
8985
90- try
91- {
92- TResult result = Run ( cancellationSource . Token ) ;
93- SetResult ( result ) ;
94- }
95- catch ( OperationCanceledException )
96- {
97- SetCanceled ( ) ;
98- }
99- catch ( Exception e )
100- {
101- SetException ( e ) ;
102- }
86+ try
87+ {
88+ TResult result = Run ( cancellationSource . Token ) ;
89+ SetResult ( result ) ;
90+ }
91+ catch ( OperationCanceledException )
92+ {
93+ SetCanceled ( ) ;
94+ }
95+ catch ( Exception e )
96+ {
97+ SetException ( e ) ;
10398 }
10499 }
105100
You can’t perform that action at this time.
0 commit comments