File tree Expand file tree Collapse file tree 3 files changed +12
-13
lines changed
src/PowerShellEditorServices
Services/PowerShell/Utility
test/PowerShellEditorServices.Test/Session Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ static ErrorRecordExtensions()
3434 s_setWriteStreamProperty = Expression . Lambda < Action < PSObject > > (
3535 Expression . Call (
3636 errorObjectParameter ,
37- writeStreamProperty . GetSetMethod ( ) ,
37+ writeStreamProperty . GetSetMethod ( nonPublic : true ) ,
3838 Expression . Constant ( errorStreamType ) ) ,
3939 errorObjectParameter )
4040 . Compile ( ) ;
Original file line number Diff line number Diff line change @@ -61,10 +61,13 @@ public static PSCommand AddDebugOutputCommand(this PSCommand psCommand)
6161
6262 public static PSCommand MergePipelineResults ( this PSCommand psCommand )
6363 {
64- // We need to do merge errors and output before rendering with an Out- cmdlet
65- Command lastCommand = psCommand . Commands [ psCommand . Commands . Count - 1 ] ;
66- lastCommand . MergeMyResults ( PipelineResultTypes . Error , PipelineResultTypes . Output ) ;
67- lastCommand . MergeMyResults ( PipelineResultTypes . Information , PipelineResultTypes . Output ) ;
64+ if ( psCommand . Commands . Count > 0 )
65+ {
66+ // We need to do merge errors and output before rendering with an Out- cmdlet
67+ Command lastCommand = psCommand . Commands [ psCommand . Commands . Count - 1 ] ;
68+ lastCommand . MergeMyResults ( PipelineResultTypes . Error , PipelineResultTypes . Output ) ;
69+ lastCommand . MergeMyResults ( PipelineResultTypes . Information , PipelineResultTypes . Output ) ;
70+ }
6871 return psCommand ;
6972 }
7073
Original file line number Diff line number Diff line change @@ -45,14 +45,10 @@ public async Task CanExecutePSCommand()
4545 [ Fact ] // https://github.com/PowerShell/vscode-powershell/issues/3677
4646 public async Task CanHandleThrow ( )
4747 {
48- // TODO: Fix this so it doesn't throw!
49- _ = await Assert . ThrowsAsync < ArgumentOutOfRangeException > ( ( ) =>
50- {
51- return psesHost . ExecutePSCommandAsync (
52- new PSCommand ( ) . AddScript ( "throw" ) ,
53- CancellationToken . None ,
54- new PowerShellExecutionOptions { ThrowOnError = false } ) ;
55- } ) . ConfigureAwait ( true ) ;
48+ await psesHost . ExecutePSCommandAsync (
49+ new PSCommand ( ) . AddScript ( "throw" ) ,
50+ CancellationToken . None ,
51+ new PowerShellExecutionOptions { ThrowOnError = false } ) . ConfigureAwait ( true ) ;
5652 }
5753
5854 [ Fact ]
You can’t perform that action at this time.
0 commit comments