Skip to content

Debugger is not showing various properties in variable panel #4314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
6 tasks done
AlexHimself opened this issue Dec 7, 2022 · 14 comments
Closed
6 tasks done

Debugger is not showing various properties in variable panel #4314

AlexHimself opened this issue Dec 7, 2022 · 14 comments
Assignees
Labels

Comments

@AlexHimself
Copy link

AlexHimself commented Dec 7, 2022

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

When debugging PowerShell relating to the PnP-SharePoint module and reviewing variables in the debugger, not all properties are being displayed.

Using the below code (see screenshot), the various properties are missing. This happens with other PS SharePoint objects as well.

I would expect at a minimum to see $item.Name visible in the debugger.

$siteURL = "https://MyOrg.sharepoint.com/sites/MyTeamSite"

Connect-PnPOnline -Url $siteURL -UseWebLogin

Get-PnPFolderItem -FolderSiteRelativeUrl "/Shared Documents" -ItemType File | ForEach-Object {
    $item = $_
    $item.Name # Set breakpoint here
}

Also $item | Get-Member -MemberType Properties -Name "Name" or even $item | Get-Member both return various properties not exposed by the debugger.

Similarly, even commands like Get-ChildItem aren't showing properties? See screenshot.

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.3.0
PSEdition                      Core
GitCommitId                    7.3.0
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

code --version
1.74.0
5235c6bb189b60b01b1f49062f4ffa42384f8c91
x64

Extension Version

code --list-extensions --show-versions | Select-String powershell

[email protected]

Steps to Reproduce

  1. Add files to a document library or the Share Document library
  2. Change $siteURL to your SharePoint site
  3. Change -FolderSiteRelativeUrl to your document library that contains some files
  4. Set breakpoint on $item.Name and examine the debugger for the local variable $item and expand the node.
  5. Issue: After expanding the node, you should not see various properties such as Name

Visuals

image

image

Logs

No response

@AlexHimself AlexHimself added the Issue-Bug A bug to squash. label Dec 7, 2022
@ghost ghost added the Needs: Triage Maintainer attention needed! label Dec 7, 2022
@AlexHimself
Copy link
Author

Other users have confirmed the same results when using some basic functions like Get-ChildItem.

This seems like something is pretty wrong? The debugger is broken for a lot of things unless I'm doing it wrong?

@andyleejordan andyleejordan added Area-Debugging and removed Needs: Triage Maintainer attention needed! labels Dec 15, 2022
@andyleejordan andyleejordan self-assigned this Dec 17, 2022
@andyleejordan
Copy link
Member

@SeeminglyScience it turns out that most of these wanted fields are marked as NonPublic properties. The C# extension includes them, so I added that flag and now all the properties we'd expect are here. Working on a PR that I'll write tests for Monday.

@andyleejordan
Copy link
Member

Actually, they were not missing because they were NonPublic, that was a red herring. They were missing because the error handling happened outside the loop, so the first field that failed to have its value retrieved caused the logic to short circuit and not load anything else. That's fixed, along with a regression test for this.

@AlexHimself
Copy link
Author

Thanks @andschwa!! Any idea when the update will be available on the marketplace?

@andyleejordan
Copy link
Member

It'll be in the preview extension later today!

@andyleejordan
Copy link
Member

@AlexHimself it's out!

@AlexHimself
Copy link
Author

AlexHimself commented Dec 21, 2022 via email

@AlexHimself
Copy link
Author

AlexHimself commented Dec 21, 2022

@AlexHimself it's out!

Hmm...@andschwa are you sure it's released? I verified my VSCode is up to date and have the PowerShell Preview extension, which is showing Dec 12 as the last changelog date.

@andyleejordan
Copy link
Member

Yes, I see v2022.12.1 released 12/20 on https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell-Preview, and in the embedded marketplace in VS Code. Maybe restart Code?

@AlexHimself
Copy link
Author

I've tried from two different computers with the same result. I show v2022.12.1 released on 12/12?

image

image

@andyleejordan
Copy link
Member

Uhh, I'm sorry, you're right, it should be v2022.12.2...funny because it shows the date as updated and the publish step didn't fail. Looking...

@andyleejordan
Copy link
Member

For now you can download the preview from https://github.com/PowerShell/vscode-powershell/releases/tag/v2022.12.2-preview and install the VSIX manually. Something must have failed on the marketplace end because the pipeline that released it literally got a "success" result from it.

@andyleejordan
Copy link
Member

I tried to manually publish and got this:

INFO Publishing 'ms-vscode.powershell-preview v2022.12.2'...
ERROR ms-vscode.powershell-preview v2022.12.2 already exists.

I think they're having server issues. I suggest waiting that out or using the VSIX manually.

@AlexHimself
Copy link
Author

That makes sense and I already installed it manually to get the v2022.12.2 version and I can confirm the debugger is working as expected! So much easier to figure out what I'm working on now with it! Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants