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
When the debugger breaks inside a function which sets a new value for a variable that was already set in the parent scope, a Watch pane expression monitoring that variable shows the value from the parent scope instead of the value from the current, function scope.
As seen in the attached screenshot, when the debugger breaks after a new value is assigned to $scope inside the Foo function, the expression $scope in the Watch pane still evaluates to the value from the parent scope ("script"). The expected value for $scope ("Foo") is displayed in the following locations:
Inside the Local variable group of the Variables pane.
After hovering the cursor over the $scope token in the code editor.
After evaluating the expression $scope in the Terminal.
Visuals
Logs
No response
The text was updated successfully, but these errors were encountered:
Prerequisites
Summary
When the debugger breaks inside a function which sets a new value for a variable that was already set in the parent scope, a Watch pane expression monitoring that variable shows the value from the parent scope instead of the value from the current, function scope.
This behavior was previously reported in #1219.
PowerShell Version
Visual Studio Code Version
Extension Version
[email protected]
Steps to Reproduce
Consider the following script that sets and outputs the value of a
$scope
variable before, inside, and after a function call:The script writes the following text to the console:
As seen in the attached screenshot, when the debugger breaks after a new value is assigned to
$scope
inside theFoo
function, the expression$scope
in the Watch pane still evaluates to the value from the parent scope ("script"
). The expected value for$scope
("Foo"
) is displayed in the following locations:$scope
token in the code editor.$scope
in the Terminal.Visuals
Logs
No response
The text was updated successfully, but these errors were encountered: