1

I have an Azure Functions project in VS Code using PowerShell where debugging just quit working. What is interesting is that the function window keeps spinning and acts as if it is still starting. You can call the function and it will work, but no breakpoints are hit and the debugging bar with the continue / stop buttons never shows up. The only way I was able to fix this was to uninstall the Azure functions extension, reboot, and reinstall the extension. It worked one time and then the problem came back. In the screenshot I've outlined the "spinner" that normally becomes a checkmark after the function app is running.

enter image description here

1 Answer 1

0

I tried running PowerShell Function via debugger and it ran successfully like below:

  • Enable Run and Debug:

enter image description here

  • Select Attach to PowerShell Functions:

enter image description here

  • This will add below given code to your launch.json set:-
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to PowerShell Functions",
            "type": "PowerShell",
            "request": "attach",
            "customPipeName": "AzureFunctionsPSWorker",
            "runspaceId": 1,
            "preLaunchTask": "func: host start"
        }
    ]
}

Click fn + f5 or Start debugging to run the Function:-

enter image description here

enter image description here

Try changing the default terminal to command prompt or powershell as mentioned in this SO answer by wilson_smyth

Refer this GitHub issue and SO thread answer.


Refer MSDOC to debug PowerShell functions locally using debugger point with Wait-Debugger attach point.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.