@@ -367,7 +367,7 @@ public async Task<string> SetVariableAsync(int variableContainerReferenceId, str
367
367
368
368
// Evaluate the expression to get back a PowerShell object from the expression string.
369
369
// This may throw, in which case the exception is propagated to the caller
370
- PSCommand evaluateExpressionCommand = new PSCommand ( ) . AddScript ( value ) ;
370
+ PSCommand evaluateExpressionCommand = new PSCommand ( ) . AddScript ( $ "[System.Diagnostics.DebuggerHidden()]param() { value } " ) ;
371
371
IReadOnlyList < object > expressionResults = await _executionService . ExecutePSCommandAsync < object > ( evaluateExpressionCommand , CancellationToken . None ) . ConfigureAwait ( false ) ;
372
372
if ( expressionResults . Count == 0 )
373
373
{
@@ -500,7 +500,7 @@ public async Task<VariableDetails> EvaluateExpressionAsync(
500
500
bool writeResultAsOutput ,
501
501
CancellationToken cancellationToken )
502
502
{
503
- PSCommand command = new PSCommand ( ) . AddScript ( expressionString ) ;
503
+ PSCommand command = new PSCommand ( ) . AddScript ( $ "[System.Diagnostics.DebuggerHidden()]param() { expressionString } " ) ;
504
504
IReadOnlyList < PSObject > results ;
505
505
try
506
506
{
@@ -799,7 +799,7 @@ private async Task FetchStackFramesAsync(string scriptNameOverride)
799
799
800
800
// PSObject is used here instead of the specific type because we get deserialized
801
801
// objects from remote sessions and want a common interface.
802
- PSCommand psCommand = new PSCommand ( ) . AddScript ( $ "[Collections.ArrayList]{ callStackVarName } = @(); { getPSCallStack } ; { returnSerializedIfInRemoteRunspace } ") ;
802
+ PSCommand psCommand = new PSCommand ( ) . AddScript ( $ "[System.Diagnostics.DebuggerHidden()]param() [ Collections.ArrayList]{ callStackVarName } = @(); { getPSCallStack } ; { returnSerializedIfInRemoteRunspace } ") ;
803
803
IReadOnlyList < PSObject > results = await _executionService . ExecutePSCommandAsync < PSObject > ( psCommand , CancellationToken . None ) . ConfigureAwait ( false ) ;
804
804
805
805
IEnumerable callStack = isRemoteRunspace
0 commit comments