azure-functions-powershell-worker: Local debugging in VS Code fails after app restart
Repro steps:
- Start a PowerShell Function app in VS Code by F5.
- Wait for the app to start. Invoke a function or do not invoke any function - does not seem to matter.
- Stop the app: hit the Disconnect button or push Ctrl-C in the terminal.
- Start the app again by F5. About 2-5 seconds after the app start, it stops and the following message appears in the terminal window:
Debug-Runspace: You cannot debug the default host Runspace using this cmdlet. To debug the default Runspace use the normal debugging commands from the host.
Further attempts to start the app fail with the same error, until VS Code is restarted.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 4
- Comments: 16 (4 by maintainers)
Tried it out and I can repro on the latest func cli, but not on v3.0.2798. We changed (cc @pragnagopa) the message indicating when VS Code could attach the debugger to a debug-specific message (“Worker process started and initialized”) that was supposed to be more reliable than the old/arbitrary message we were using (“Host lock lease acquired by instance ID”). I would guess this is a timing problem and for some reason the new message is printed too early for us to attach, but I have no idea how this PowerShell stuff works under the covers or what could be happening during the time between messages
Here are two workarounds in the meantime:
.vscode/tasks.jsonto use the old message:This is happening to me @AnatoliB after upgrading to Core Tools
3.0.2881Runtime3.0.14287.0Powershell Worker3.0.293using theAttach to Powershell Functionsin VSCodeAlso nothing works at the debug prompt in the integrated console (
7.0.3), every command just hangs until I step but the command never evaluates. Watch variables still work though