Closed andyleejordan closed 11 months ago
Tada!
Just curious - does this PR address other cases in which $null -eq $var == $true
in the WATCH list as well? The built-in $null: ""
wasn't the only case in which a null value was represented as an empty string ""
e.g. an unitilialized variable should be shown as $VarThatDoesNotExist: $null
and not $VarThatDoesNotExist: ""
.
Hm, I hadn't tried $VarThatDoesNotExist
and it wasn't in the issue, so probably not. I can take a look. Anything else you know about?
Ha no problem - $VarThatDoesNotExist
is actually mentioned in the first bullet point of the issue and also in the screenshot. When debugging a PowerShell script, I would except all cases where $null -eq XYZ == $true
would show XYZ: $null
in the WATCH pane -- rather than sometimes XYZ: $null
and other times XYZ: ""
. There's some MS Learn documentation on some of the subtleties of evaluating $null
.
Ok I took another look at this and now not only do I have answer as to why $null
was being evaluated to ""
, I fixed the root cause 🥳
No idea why its value was
""
, but it was, so we special case it and return$null
just like you get from watched variables that were assigned the built-in$null
.Resolves https://github.com/PowerShell/vscode-powershell/issues/4816.