Python debugging in Visual Studio 2019


has anyone managed to attach the Visual Studio 2019 (community edition) debugger to Slicer’s python? I installed the Slicer DebuggingTools extension and followed the steps in the extension’s documentation for attaching SlicerPython to the Visual Studio 2017 debugger, but this seems to no longer apply to the 2019 version. There is no connection type “Python remote (ptvsd)”, just “Python remote (debugpy)”, but when I choose that one and input the target “tcp://slicer@localhost:5678” , it fails with an error message I don’t really understand (see screenshot) when I click “Find…”

Has someone run into this problem before? Any advice would be greatly appreciated.

Thank you very much.

Port Selector is not implemented (not necessary) for the Python debugger. See more information here:

I’ve tried Visual Studio’s Python debugger about a year ago and it worked OK then. Visual Studio code is quite similar in capability. I usually use PyCharm because it can automatically reconnect when I restart Slicer, which is a huge convenience (you need the “professional” version, which you get for free if you are a student or have a university email address).

Thank you very much, I will give it another try soon. Otherwise I’ll install PyCharm.