Debug Pode #783
-
Hello, I am using Pode as an REST Api and it is great! Thank you for sharing this wonderfult project. I am using Pode v2.2.3, Visual Studio Code 1.57.1 with the PowerShell extension, ms-vscode v2021.2.2. Here is a sample code that I use to test the breakpoint on line
I would like to debug inside vsc with the config provided from the PowerShell extension,
how do you usually debug? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hey @stiezinger, Usually when I'm debugging, I just pipe stuff into Pode uses a lot of runspaces behind the scenes, which is why the breakpoints won't get triggered. It's something I've been meaning to look into properly for quite sometime, being able to use The last time I tried looking into this, it went something like this:
^ and that will let you step through the runspace when you hit it with a request. I haven't tested it properly, and I do want to look into how to make it cleaner and easier to use. |
Beta Was this translation helpful? Give feedback.
-
Here is some peculiar but surprisingly robust bare runspace debugger: In your Pode route handler or similar code call When breakpoints are hit, enter debugger commands as prompted (either in console or GUI depending on the host and Trivial example: add the debugger and break immediately after: Add-Debugger
Wait-Debugger Tip: Use |
Beta Was this translation helpful? Give feedback.
Hey @stiezinger,
Usually when I'm debugging, I just pipe stuff into
Out-Default
or useNew-PodeLoggingMethod -Terminal | Enable-PodeErrorLogging
to get values onto the terminal 😂Pode uses a lot of runspaces behind the scenes, which is why the breakpoints won't get triggered. It's something I've been meaning to look into properly for quite sometime, being able to use
Debug-Runspace
and document how to do it. It might be possible to somehow make VSC use it's breakpoints, but I'll need to properly investigate how to (and if anyone here has managed it, feel free to say how!).The last time I tried looking into this, it went something like this:
-Threads 1