@@ -95,6 +95,36 @@ public void Dispose()
95
95
this . powerShellContext . Close ( ) ;
96
96
}
97
97
98
+ [ Trait ( "Category" , "DebugService" ) ]
99
+ [ Fact ]
100
+ // This regression test asserts that `ExecuteScriptWithArgsAsync` works for both script
101
+ // files and, in this case, in-line scripts (commands). The bug was that the cwd was
102
+ // erroneously prepended when the script argument was a command.
103
+ public async Task DebuggerAcceptsInlineScript ( )
104
+ {
105
+ await this . debugService . SetCommandBreakpointsAsync (
106
+ new [ ] { CommandBreakpointDetails . Create ( "Get-Random" ) } ) . ConfigureAwait ( false ) ;
107
+
108
+ Task executeTask =
109
+ this . powerShellContext . ExecuteScriptWithArgsAsync (
110
+ "Get-Random" , string . Join ( " " , "-Maximum" , "100" ) ) ;
111
+
112
+ await this . AssertDebuggerStopped ( "" , 1 ) . ConfigureAwait ( false ) ;
113
+ this . debugService . Continue ( ) ;
114
+ await executeTask . ConfigureAwait ( false ) ;
115
+
116
+ StackFrameDetails [ ] stackFrames = debugService . GetStackFrames ( ) ;
117
+ Assert . Equal ( StackFrameDetails . NoFileScriptPath , stackFrames [ 0 ] . ScriptPath ) ;
118
+
119
+ VariableDetailsBase [ ] variables =
120
+ debugService . GetVariables ( stackFrames [ 0 ] . LocalVariables . Id ) ;
121
+
122
+ var var = variables . FirstOrDefault ( v => v . Name == "$Error" ) ;
123
+ Assert . NotNull ( var ) ;
124
+ Assert . True ( var . IsExpandable ) ;
125
+ Assert . Equal ( "[ArrayList: 0]" , var . ValueString ) ;
126
+ }
127
+
98
128
public static IEnumerable < object [ ] > DebuggerAcceptsScriptArgsTestData
99
129
{
100
130
get
0 commit comments