Skip to content

Cannot inspect variables or use debug commands in Azure Functions in terminal #3137

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
yobyot opened this issue Jan 18, 2021 · 25 comments
Closed
Assignees
Labels
Area-Debugging Issue-Bug A bug to squash. Resolution-Fixed Will close automatically.

Comments

@yobyot
Copy link

yobyot commented Jan 18, 2021

Issue Description

Debugging an Azure Function using the PowerShell extension for VS Code.

Attached Logs

Follow the instructions in the README about
capturing and sending logs.

Environment Information

Visual Studio Code

Name Version
Operating System Darwin x64 20.2.0
VSCode 1.52.1
PowerShell Extension Version 2020.6.0

PowerShell Information

Name Value
PSVersion 7.1.1
PSEdition Core
GitCommitId 7.1.1
OS Darwin 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:39:59 PST 2020, root:xnu-7195.60.75~1/RELEASE_X86_64
Platform Unix
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.1
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
aws-toolkit-vscode amazonwebservices 1.18.0
azure-account ms-vscode 0.9.4
azurerm-vscode-tools msazurermtools 0.14.0
gitlens eamodio 11.1.3
powershell ms-vscode 2020.6.0
vscode-azurefunctions ms-azuretools 1.1.0
vscode-dotnet-runtime ms-dotnettools 1.0.0
vscode-icons vscode-icons-team 11.1.0
vscode-logicapps ms-azuretools 1.0.2

Problem description

I hope the two attached animations make the point: I cannot debug an Azure Function in VS Code. As you can see, it's possible to do so in pwsh consoles. If there's a setting that enables a regular debugging session in VS Code, I can't find it so I am reporting this as a bug. I hope it's a user error (caused by pitiful doc) and not one of those "You just can't do it in VS Code" issues that seem to plague the PowerShell environment in VS Code.

Debugging in a pair of consoles (works):

2021-01-18_16-17-17 (1)

Debugging in VS Code (no input possible):

2021-01-18_15-57-26 (1)

@ghost ghost added the Needs: Triage Maintainer attention needed! label Jan 18, 2021
@SydneyhSmith
Copy link
Collaborator

Thanks @yobyot it would be really helpful if you could also attach the logs--instructions for how to do that are here ! Thanks for providing the GIFs and description those are great!

@SydneyhSmith SydneyhSmith added Needs-Repro-Info and removed Needs: Triage Maintainer attention needed! labels Jan 19, 2021
@yobyot
Copy link
Author

yobyot commented Jan 20, 2021

@SydneyhSmith

Hi. I've sent a .zip of the requested logs to [email protected].

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jan 20, 2021
@yobyot
Copy link
Author

yobyot commented Jan 21, 2021

FWIW, here's a screenshot from a virgin Windows 10 machine, running pwsh 7.1.1, latest pwsh extension and Core Tools running the default Azure Functions HTTP project with a breakpoint set. This VM is in a client environment completely separate from the macOS environment from which I first reported this problem.

It's been, literally, years and years now that the PowerShell extension hasn't played nice with the VS Code debugger. I've reporting only a few of the issues I've experienced, all of which either were closed with pointed fingers elsewhere or were "wait for us to rearchitect." It makes one long for the ISE -- however limited it was, it was reliable. I just don't understand how PowerShell developers can be expected to depend on this extension, which is still labelled "preview" (and not to be confused with the "preview, preview" version of the extension).

2021-01-21_15-47-16

If I'm doing something wrong, I'd be happy to fix it -- providing it's documented. As it is, the paragraph or two on debugging a function in VS Code is embarrassingly thin.

@SydneyhSmith
Copy link
Collaborator

Thanks @yobyot for all the detailed information, we really appreciate it. Unfortunately, this will take more investigation on our part--thanks for your patience!

@SydneyhSmith SydneyhSmith added Area-Debugging Issue-Bug A bug to squash. and removed Needs-Repro-Info Needs: Maintainer Attention Maintainer attention needed! labels Feb 2, 2021
@yobyot
Copy link
Author

yobyot commented Jun 23, 2021

Hello, pwshTeam.

Any update on this issue? A workaround? Anything?

It's so hard to write an Az Function using the command line debugger.

Thanks.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 23, 2021
@andyleejordan
Copy link
Member

Can you confirm it's not working in the same manner with the latest release? We switched to use the Debug Adapter Protocol in February. On that note, the debugger is actually getting rewired (again, but it's necessary) as part of PowerShell/PowerShellEditorServices#1295

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Jun 24, 2021
@yobyot
Copy link
Author

yobyot commented Jun 24, 2021

Confirmed. Exactly the same problem.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 24, 2021
@andyleejordan
Copy link
Member

Dang, well, we're actively fixing some threading issues in PowerShell/PowerShellEditorServices#1295 which will also change the underlying debugger implementation quite a bit, perhaps it'll be fixed then.

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Jul 13, 2021
@yobyot
Copy link
Author

yobyot commented Jul 13, 2021

Perhaps? Maybe? Possibly? That's not especially comforting -- especially when this Azure Functions PowerShell support is GA and debugging a function has never worked correctly. Isn't anyone at Microsoft embarrassed that one cannot accurately and conveniently debug PowerShell Azure Functions? (Even a local PowerShell script debug session isn't all that reliable, either.)

Sorry to be a pain but the agony inflicted on PowerShell developers by never really completely replacing the ISE has gone on too long.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jul 13, 2021
@andyleejordan
Copy link
Member

We're working on it!

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Jul 13, 2021
@yobyot
Copy link
Author

yobyot commented Sep 29, 2021

Hello, is this problem being worked on as part of https://github.com/PowerShell/vscode-powershell/projects/9?

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Sep 29, 2021
@andyleejordan
Copy link
Member

Yes @yobyot! And it's under review, @rjmholt has made excellent progress.

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Oct 5, 2021
@CallumCrowley
Copy link

Is there an update on this?

@andyleejordan
Copy link
Member

@CallumCrowley the previously mentioned work has been long since merged and we've been stabilizing it. Can you please test the PowerShell Preview for VS Code and let me know if this is resolved?

@andyleejordan andyleejordan added the Needs: Fix Verification Please verify the fix for us! label Apr 13, 2022
@yobyot
Copy link
Author

yobyot commented Apr 13, 2022

Preview extension didn’t work for me.

@andyleejordan
Copy link
Member

Oh, oh, I see you are trying to use attach to runspace. This is almost fixed! @SeeminglyScience has been hard at work on it and PowerShell/PowerShellEditorServices#1752 is under review!

@andyleejordan andyleejordan removed the Needs: Fix Verification Please verify the fix for us! label Apr 13, 2022
@andyleejordan andyleejordan moved this to In Progress in Sea Biscuit Apr 13, 2022
@CallumCrowley
Copy link

@andschwa great! I'll give it a go 😊

@yobyot
Copy link
Author

yobyot commented Apr 13, 2022

Let's pause for a moment and remind ourselves that GA of Azure Functions support for PowerShell was announced in November of 2019.

In the nearly three year since, nobody AFAIK has ever been able to use VS Code to write and debug a Function. Since the ISE is long dead, in essence that means nobody has been able to write a Function in PowerShell suitable for production deployment.

Yes, I'm being critical of the PowerShell team here for their lack of understanding the requirements of production-quality code in their product and in the customers' environments. And, yes, they had every excuse in the book ready: we don't have people, this requires a re-write, and on and on.

As a PowerShell fan, this is a tragedy.

@JustinGrote
Copy link
Collaborator

@yobyot good news! The latest preview 2022.4.1 when it releases should have fixed this finally. It was a very difficult bug to remediate.

image

@yobyot
Copy link
Author

yobyot commented Apr 18, 2022

Preview? What I care about is GA code. My client that does not permit public preview tools or resources.

@JustinGrote
Copy link
Collaborator

@yobyot this latest preview is a release candidate, it's expected to make it to stable in the next few weeks!

@andyleejordan
Copy link
Member

Preview? What I care about is GA code. My client that does not permit public preview tools or resources.

@yobyot things take time! Please be patient, there was a ton that went into fixing this, and it is fixed now. Please test the preview extension (if you cannot do so for work, test it in another environment).

@andyleejordan andyleejordan added the Resolution-Fixed Will close automatically. label Apr 19, 2022
@andyleejordan andyleejordan moved this from In Progress to Done in Sea Biscuit Apr 19, 2022
@ghost ghost closed this as completed Apr 19, 2022
@ghost
Copy link

ghost commented Apr 19, 2022

This issue has been marked as fixed. It has been automatically closed for housekeeping purposes.

@CallumCrowley
Copy link

@JustinGrote @andschwa thanks for your work on this! 😄

@andyleejordan
Copy link
Member

It was @SeeminglyScience that fixed it!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Debugging Issue-Bug A bug to squash. Resolution-Fixed Will close automatically.
Projects
No open projects
Status: Done
Development

No branches or pull requests

6 participants