question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot set remote breakpoints in visual studio 2019 IDE

See original GitHub issue

When I click to set a breakpoint manually in the IDE, I get the message "Breakpoint will not currently be hit. Breakpoint in file that does not currently exist." I can, however, attach to the process, step through code, and stop at breakpoints set programmatically. From reading the docs, I believe this is supposed to “just work” in Visual Studio 2019.

PTVSD was installed with conda and the environment is active when running the source code.

$conda list ptvsd
<...>
# Name                    Version                   Build  Channel
ptvsd                     4.3.2            py27h516909a_0    conda-forge

$python --version
Python 2.7.15

The code is running on Ubuntu under the Windows Subsystem for Linux. In Visual Studio I open the folder and file, then go to Debug->Attach->tcp://localhost:5678. The Visual Studio “Current Python Environment” is set to 2.7.

I am running my python module simply with python mycode.py, and the file contains:

import ptvsd
ptvsd.enable_attach()
ptvsd.wait_for_attach()

Aside - I’m unsure whether this is related to pathmappings and if so, how does one set that for VS2019. I am not using VS Code.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
int19hcommented, Feb 11, 2021

The root cause is what Hugues explained earlier.

In ptvsd 3 - the legacy one - breakpoint matching was done on the basis of qualified module name, which it obtained by walking the filesystem on both ends and observing __init__.py. This meant that the user didn’t have to set up any explicit path mappings. But it broke as soon as Python added namespace packages (which are just regular folders).

In more recent versions, and in debugpy, we inherit pydevd behavior, which requires explicit path mappings to be specified (and thus also works with any Python version). This is done via launch configuration, so for VSCode, the users just add it to their launch.json:

https://code.visualstudio.com/docs/python/debugging#_remote-script-debugging-with-ssh

For VS, there was no such way, so it had to be wired up into project settings somehow. Or maybe expose a generic facility for the users to add raw JSON configuration directly - since this sort of thing will come up with any other feature that is controlled via configuration, it might be a good idea to have a catch-all like that, and then gradually implement UI settings for those parts of JSON that are commonly used.

0reactions
bschnurrcommented, Feb 10, 2021

@int19h any thoughts?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot set remote breakpoints in Visual Studio Community ...
Without an id, 'breakpoint' events cannot be used. whenever I add a new breakpoint in the code while the debugger is attached and...
Read more >
Unable to Connect to the Microsoft Visual Studio Remote ...
To fix this, download and install the matching version of the remote debugging monitor. To get the correct version of the remote debugger,...
Read more >
Troubleshoot Breakpoints in the Visual Studio Debugger
If you're debugging optimized code, make sure the function where your breakpoint is set isn't being inlined into another function. The Debugger.
Read more >
Remote debugging - Visual Studio (Windows)
Debug a Visual Studio application that has been deployed on a different computer by using the Visual Studio remote debugger.
Read more >
Not able to set breakpoint in visual studio
With that one syntax error, it was causling the Studio 2019 IDE to fail in allowing me to set a break point anywhere....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found