Skip to content

When the built-in $null was watched its value was incorrect #4816

Closed
PowerShell/PowerShellEditorServices
#2097
@thegraffix

Description

@thegraffix

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

The debugging WATCH pane shows $null: ""

image



  • The way $null is represented makes it difficult to distinguish between an empty string value $MyStringVar = "" vs an uninitialzed variable $VarThatDoesNotExist.
  • I'm not certain if this is VSCode or the PowerShell extension

PowerShell Version

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.3.9
PSEdition                      Core
GitCommitId                    7.3.9
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.10032.0, 6.0.0, 6.1.0, 6.2.0, 7.0.0, 7.1.0, 7.2.0, 7.3.9}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

PS C:\> code --version
1.84.0
d037ac076cee195194f93ce6fe2bdfe2969cc82d
x64

Extension Version

PS C:\> code --list-extensions --show-versions | Select-String powershell

ms-vscode.powershell@2023.8.0

Steps to Reproduce

Add $null to the debugging WATCH list.

Visuals

No response

Logs

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions