PTVS
PTVS copied to clipboard
native/python debugger cannot find python source code
This issue has been moved from a ticket on Developer Community.
I´m trying to debug python code being called from native code. At first the native/python debugger was not in the list of available debuggers of the native project, description of the (old) issue and workaround can be found here: https://github.com/Microsoft/PTVS/issues/6712?ref=pythonrepo.com With the workaround applied I can now start the native/python debugger and debug the native code. I cannot debug the python code though, instead the "source not found" window is being displayed. When I click on "Browse and find *.py..." it displays "Source search information" saying the source HAS been found and the debugger will use it - but it doesn´t switch to the code:
Visual Studio Version: 17.4.1 (up to date)
Original Comments
Feedback Bot on 11/21/2022, 05:26 PM:
(private comment, text removed)
Original Solutions
(no solutions)
What happens if you just open the file directly via File -> Open?
The file opens as it should. No debugging possible though.
Some more details: The call path is native code -> python -> native code. The "Source not found" window appears when I place a breakpoint in the native code called from python, then in the call stack window click on the python file.
I have now tried to debug step into (F11) the python code from native. Instead of stepping into the python code though it steps over. After the first time I have placed a breakpoint in the native code being called from python the behaviour is slightly different: When I try to step into the python code the next time I get a message "Unable to step. An operation is not legal in the current state." The only way to continue debugging then is debug continue (F5), while both step into and step over (F10/F11) lead to this error message.
Potentially related to https://github.com/microsoft/PTVS/issues/6900