Local debugging in VS Code fails after app restart
See original GitHub issueRepro 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.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:16 (4 by maintainers)
Top Results From Across the Web
Debug in visual studio code is not working
Very simple solution is -> just uninstall debugger and delete launch.json file After that reinstall debugger then start.
Read more >Debugging in Visual Studio Code
To run or debug a simple app in VS Code, select Run and Debug on the Debug start view or press F5 and...
Read more >Troubleshoot Terminal launch failures
You can try killing unused programs and processes on your machine in case one of them is keeping a terminal shell process active...
Read more >Debug Node.js Apps using Visual Studio Code
The Visual Studio Code editor includes Node.js debugging support. Set breakpoints, step-in, inspect variables and more.
Read more >Remote Development Tips and Tricks
Visual Studio Code Remote Development troubleshooting tips and tricks for SSH, Containers, and the Windows Subsystem for Linux (WSL)
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.json
to use the old message:This is happening to me @AnatoliB after upgrading to Core Tools
3.0.2881
Runtime3.0.14287.0
Powershell Worker3.0.293
using theAttach to Powershell Functions
in 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