File tree 3 files changed +12
-13
lines changed
src/PowerShellEditorServices
Services/PowerShell/Utility
test/PowerShellEditorServices.Test/Session 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ static ErrorRecordExtensions()
34
34
s_setWriteStreamProperty = Expression . Lambda < Action < PSObject > > (
35
35
Expression . Call (
36
36
errorObjectParameter ,
37
- writeStreamProperty . GetSetMethod ( ) ,
37
+ writeStreamProperty . GetSetMethod ( nonPublic : true ) ,
38
38
Expression . Constant ( errorStreamType ) ) ,
39
39
errorObjectParameter )
40
40
. Compile ( ) ;
Original file line number Diff line number Diff line change @@ -61,10 +61,13 @@ public static PSCommand AddDebugOutputCommand(this PSCommand psCommand)
61
61
62
62
public static PSCommand MergePipelineResults ( this PSCommand psCommand )
63
63
{
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
+ }
68
71
return psCommand ;
69
72
}
70
73
Original file line number Diff line number Diff line change @@ -46,14 +46,10 @@ public async Task CanExecutePSCommand()
46
46
[ Fact ]
47
47
public async Task CanHandleThrow ( )
48
48
{
49
- // TODO: Fix this so it doesn't throw!
50
- _ = await Assert . ThrowsAsync < ArgumentOutOfRangeException > ( ( ) =>
51
- {
52
- return psesHost . ExecutePSCommandAsync (
53
- new PSCommand ( ) . AddScript ( "throw" ) ,
54
- CancellationToken . None ,
55
- new PowerShellExecutionOptions { ThrowOnError = false } ) ;
56
- } ) . ConfigureAwait ( true ) ;
49
+ await psesHost . ExecutePSCommandAsync (
50
+ new PSCommand ( ) . AddScript ( "throw" ) ,
51
+ CancellationToken . None ,
52
+ new PowerShellExecutionOptions { ThrowOnError = false } ) . ConfigureAwait ( true ) ;
57
53
}
58
54
59
55
[ Trait ( "Category" , "PsesInternalHost" ) ]
You can’t perform that action at this time.
0 commit comments