You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make sure you are able to repro it on the latest version
Search the existing issues.
Steps to reproduce
$myVarName=123& {
$myVarName=456$myVarName# breakpoint here
}
While debugging the script above and stopped at line 4 ($myVarName), evaluate debugger call using context: 'watch', expression: '$myVarName' returns the value from parent scope (123).
Simply changing the expression to $myVarName; returns the local value (456). This points us in the direction of this method as source of the bug.
The evaluate-call in my scenario is made through using new vscode.InlineValueEvaluatableExpression(range, expression) which VSCode executes here
Expected behavior
evaluate should return the local value (456). The local value is shown in Variable Explorer, PSIC and by inline using vscode.InlineValueVariableLookup while stopped at the same location.
Actual behavior
Returns 123.
After executing $script:myVarName or $global:myVarName in PSIC and using step over, evaluate returns the newest value (no scope-preference/-priority).
Changing $myVarName in PSIC + step over updates variable explorer + vscode.InlineValueVariableLookup result, but evaluate doesn't care - still showing the latest parent-scope value.
Error details
No response
Environment data
Name Value
---------
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022
Platform Unix
PSCompatibleVersions {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Version
2022.7.2
Visuals
No response
The text was updated successfully, but these errors were encountered:
fflaten
changed the title
Evaluate expression event returns variable value from wrong scope
Evaluate expression returns variable value from wrong scope
Aug 12, 2022
Prerequisites
Steps to reproduce
While debugging the script above and stopped at line 4 (
$myVarName
),evaluate
debugger call usingcontext: 'watch', expression: '$myVarName'
returns the value from parent scope (123).Simply changing the expression to
$myVarName;
returns the local value (456). This points us in the direction of this method as source of the bug.PowerShellEditorServices/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/DebugEvaluateHandler.cs
Lines 63 to 64 in 00238cd
The evaluate-call in my scenario is made through using
new vscode.InlineValueEvaluatableExpression(range, expression)
which VSCode executes hereExpected behavior
evaluate
should return the local value (456). The local value is shown in Variable Explorer, PSIC and by inline usingvscode.InlineValueVariableLookup
while stopped at the same location.Actual behavior
Returns 123.
After executing
$script:myVarName
or$global:myVarName
in PSIC and using step over,evaluate
returns the newest value (no scope-preference/-priority).Changing
$myVarName
in PSIC + step over updates variable explorer +vscode.InlineValueVariableLookup
result, butevaluate
doesn't care - still showing the latest parent-scope value.Error details
No response
Environment data
Version
2022.7.2
Visuals
No response
The text was updated successfully, but these errors were encountered: