Skip to content
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

PNP.PowerShell scripts not working in VS Code with PowerShell extension #5032

Closed
4 of 6 tasks
nirmala24 opened this issue Aug 23, 2024 · 11 comments
Closed
4 of 6 tasks
Labels
Issue-Bug A bug to squash. Needs: Fix Verification Please verify the fix for us! Resolution-Duplicate Will close automatically.

Comments

@nirmala24
Copy link

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

I am having issues running PnP PowerShell scripts in VS Code with PowerShell extension. Using normal PowerShell (pwsh), all PnP commands work as expected. The issue is only occurring while debugging the .ps1 script files using the PowerShell extension in VS Code.

Executing the script with the PowerShell extension Integrated console terminal are running as expected, but unable to debug the same .ps1 script with pnp powershell commands as none of the CMDlets are working.

I have read an issue about the PowerShell extension issue with VS Code(#3510), but I am having issues using debugging the scripts with PowerShell extension.

Details of my environment:

PnP.PowerShell-Module Version 2.9.0
PnP.PowerShell 7.4.5

VSCode version
1.92.2
fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
x64

PowerShell extension for VS Code
ms-vscode.?[7mpowershell?[[email protected]

This was working fine couple of days before

PowerShell Version

PS C:\> $PSVersionTable; $Host

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

Name             : Visual Studio Code Host
Version          : 2024.2.2
InstanceId       : 971bdbc3-d8ee-4683-bc48-2e4994688114
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace


PS C:\>

Visual Studio Code Version

PS C:\> code --version
1.92.2
fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
x64
PS C:\>

Extension Version

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

ms-vscode.?[7mpowershell?[[email protected]

PS C:\>

Steps to Reproduce

Install PnP.PowerShell module
Install VS Code
Get the PowerShell extension for VS Code
Open a file and save it as .ps1 with the below pnp PowerShell commands.

Connect-PnPOnline -site "https://abc.sharepoint.com/sites/testsite1" -Interactive
$DL = Get-PnPList -Identity "Shared Documents"

Debug the saved .ps1 with the PowerShell extension integrated console as the selected terminal

Visuals

Github_PowerShellIssue

Screenshot 2024-08-23 173122

Logs

No response

@nirmala24 nirmala24 added Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed! labels Aug 23, 2024
@andyleejordan
Copy link
Member

Please see the pinned issue #3510

@andyleejordan andyleejordan added Resolution-Duplicate Will close automatically. and removed Needs: Triage Maintainer attention needed! labels Aug 23, 2024
@JustinGrote
Copy link
Collaborator

@nirmala24 I know you noted you read it, but to expand, because of the way PnP.PowerShell doesn't isolate all of its dependencies, it causes conflicts with the pieces that make vscode work. This has to be fixed by PnP.PowerSehell.

Copy link
Contributor

This issue has been labeled as resolved, please verify the provided fix (or other reason).

@github-actions github-actions bot added the Needs: Fix Verification Please verify the fix for us! label Aug 23, 2024
@nirmala24
Copy link
Author

Please see the pinned issue #3510

Thank you for the reply.

I have gone through #3510 before raising the issue and the suggested workaround doesn't work for me. My issue is, I couldn't debug the .ps1 script using powershell extension for VS code.

@nirmala24
Copy link
Author

This issue has been labeled as resolved, please verify the provided fix (or other reason).

I do not believe this was resolved. This is still an outstanding issue for me. This started happening in the past couple of days.

Copy link
Contributor

This issue has been labeled as resolved, please verify the provided fix (or other reason).

@github-actions github-actions bot added Needs: Maintainer Attention Maintainer attention needed! Needs: Fix Verification Please verify the fix for us! and removed Needs: Fix Verification Please verify the fix for us! Needs: Maintainer Attention Maintainer attention needed! labels Aug 25, 2024
@nirmala24
Copy link
Author

nirmala24 commented Aug 27, 2024

@nirmala24 I know you noted you read it, but to expand, because of the way PnP.PowerShell doesn't isolate all of its dependencies, it causes conflicts with the pieces that make vscode work. This has to be fixed by PnP.PowerSehell.

@JustinGrote - Thanks for the response. Any idea on how or when this will be fixed. Or any workarounds other than the ones mentioned in #3510. Or any other alternate editors other than VS code for PnP.PowerShell

@github-actions github-actions bot removed the Needs: Fix Verification Please verify the fix for us! label Aug 27, 2024
Copy link
Contributor

This issue has been labeled as resolved, please verify the provided fix (or other reason).

@JustinGrote
Copy link
Collaborator

@nirmala24 I opened a relevant issue in the repo: pnp/powershell#4192, you can comment and follow the status there.

@github-actions github-actions bot added Needs: Maintainer Attention Maintainer attention needed! and removed Needs: Fix Verification Please verify the fix for us! labels Aug 27, 2024
Copy link
Contributor

This issue has been labeled as resolved, please verify the provided fix (or other reason).

@github-actions github-actions bot added Needs: Fix Verification Please verify the fix for us! and removed Needs: Maintainer Attention Maintainer attention needed! labels Aug 27, 2024
@JustinGrote JustinGrote closed this as not planned Won't fix, can't repro, duplicate, stale Aug 27, 2024
@jackpoz
Copy link

jackpoz commented Aug 27, 2024

Cannot confirm the issue, debugging works fine:
image

Using [email protected] , PnP PowerShell 2.9.9, VS Code 1.92.2, PSVersion 7.4.5 .

The HTTP error 404 means the list with name "Shared Documents" doesn't exist. It wounds unrelated to .NET isolation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash. Needs: Fix Verification Please verify the fix for us! Resolution-Duplicate Will close automatically.
Projects
None yet
Development

No branches or pull requests

4 participants