Debug watched array item is shown as an empty string · Issue #1897 · PowerShell/vscode-powershell · GitHub
Skip to content

Debug watched array item is shown as an empty string #1897

Open

Description

@cawoodm

Fully described here: microsoft/vscode#72433

Debugging PowerShell: an array value is shown as an empty string on the left but it's plainly not empty on hover or under locals:

System Details

VSCode version:

1.33.1 51b0b28134d51361cf996d2f0a1c698247aeabd8 x64

VSCode extensions:

  • Fr43nk.seito-openfile@1.8.5
  • ms-vscode.powershell@1.12.1
  • rozzzly-dev.vscode-prompt-debug@0.0.2

PSES version: 1.12.1.0

PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.16299.820
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.820
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I am experiencing a problem with watching an item in a (large) array - the value is not displayed correctly (at all).
image

Expected Behaviour

Should be seeing the array value

Actual Behaviour

Array item is displayed as the empty string "" but only on the left. Elsewhere (hover, locals) it's displayed correctly

image

NOTE: I have verified this bug with all extensions (except the PowerShell extension of course) disabled.

Activity

  1. TylerLeonhardt commented on Apr 18, 2019

    @TylerLeonhardt
    Member

    Keith Hill (@rkeithhill) I remember you talking about how a user could get a "logpoints"-like feature using the watch parameters... I believe that mechanism could also solve this problem, no?

  2. noambonnie commented on Apr 22, 2019

    @noambonnie

    Possibly related: Seeing empty string for a non-empty string (but also on mouse-oveR). I have a function with the following signature:

    func GenUUID(prefix string) string
    

    Then the following code:

    requestID := utils.GenUUID("")
    

    Printing requestID with fmt.Println(requestID) prints a result (as expected). Watch, mouse-over show ""

  3. rjmholt commented on Apr 22, 2019

    @rjmholt
    Contributor

    noambonnie That looks like Go rather than PowerShell. Is this in the PowerShell extension?

  4. rjmholt commented on Apr 22, 2019

    @rjmholt
    Contributor

    Marc (@cawoodm) My suspicion is that the Watch window doesn't support an expression using the syntax expected. If you put the variable without the [0], does it show the whole array? We've been trying to track down what syntax if any allows you to watch a single array member, but haven't been able to find any documentation of that. Have you seen this work elsewhere?

  5. rkeithhill commented on Apr 22, 2019

    @rkeithhill
    Contributor

    That syntax is correct and I can get a watch like $arr[1] to display data.

  6. rjmholt commented on Apr 23, 2019

    @rjmholt
    Contributor

    Ok, so it works sometimes in the PowerShell extension?

    Might be worth showing both $OP_A1 and OP_A1[0] in Marc (@cawoodm)'s case.

  7. noambonnie commented on Apr 23, 2019

    @noambonnie

    noambonnie That looks like Go rather than PowerShell. Is this in the PowerShell extension?

    Oops apologies. You're correct. I don't know how I ended up here.

  8. cawoodm commented on Apr 24, 2019

    @cawoodm
    Author

    image

    image

    image

    You might also notice the + in Watch is grayed out so I can't add new watches. To be honest the whole Variables function is very dodgy/buggy and I have to often restart VSCode to get it to behave.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions