PTVS: VS-2022 "Python/Native Debugging" not working after being brought back from missing

After a clean install VS-2022 and “returning back” “Python/Native Debugging”, as suggested here with copying files from .../v16/... to .../v17/..., the debugging feature doesn’t work in Python code, and the breakpoints won’t be triggered in Python code at all.

Steps to Reproduce

  1. Make sure to remove all Pythons from Windows. That is to make sure we are testing everything against same vanilla Python.
  2. Install Python 3.6 x64 with Web Installer, all default locations, but check to install debug symbols and everything else in the “Additional” settings. We use 3.6 here to avoid these things with venv occurring from 3.8 and onwards.
  3. Fresh-install VS-2017, VS-2019 and VS-2022. DO NOT install Python with Visual Studio: this is to guarantee that all three different VS are tested against exact same Python, which we installed previously.
  4. Fix VS-2022 “Python/Native Debugging” missing, as described in https://github.com/microsoft/PTVS/issues/6712.
  5. Clone my projects showing the issue: https://github.com/flexorx/simple_cpp_python. These are 3 identical projects, but each set to the right VS target.
  6. Change the paths in projects to the right ones for your Python 3.6 installed location, i.e. c:\Users\x1\AppData\Local\Programs\Python\Python36\include\ to your location, and c:\Users\x1\AppData\Local\Programs\Python\Python36\libs\ to yours.
  7. See the video attached below, follow how the breakpoints are set, and go through all three projects to verify that the Python breakpoint is hit in VS-2017 and VS-2019, but not in VS-2022.

StrangeThing2

Expected behavior

Debugging with breakpoints work both in Python and in C++ in “Python/Native Debugging” in VS-2022.

Sample Code

https://github.com/flexorx/simple_cpp_python

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments