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.

Failed to launch debug adapter in romote debugging with debugpy.

See original GitHub issue

Python Environment: image

Steps to Reproduce 1.Typing code in .py and set breakpoint in the code.

input('>')
print('hello')

2.Install “debugpy” in the current python environment. 3.In command prompt(right-click the python environment and select “Open Command Prompt Here…”), execute: python -m debugpy --listen 127.0.0.1:4022 C:\Users\vwazho\source\repos\PythonApplication1\PythonApplication1\PythonApplication1.py 4. Launch VS and Debug > Attach to Process, in dialog: a. Select connection type with Python remote(ptvsd) b. Connection target with 127.0.0.1:4022 c. In Available processes list, select the appropriate python.exe, click “Attach” 5. Type enter in the console 6.Check that it stops at the breakpoint Expected behavior remote attach successfully with no errors

Actual behavior error dialog pop up when attaching. image

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
AdamYoblickcommented, Jan 25, 2021

@int19h I believe this is due to some parsing of the adapterLaunchInfo I added to support passing variable presentation options to the debugger upon launch. I tested when launching through the VS but I didn’t test when debugging by attaching to a remote process, which is causing this error.

Specifically, in DebugAdapterLauncher.cs, line 207:

try {
                var adapterLaunchInfoJson = JObject.Parse(adapterLaunchInfo.LaunchJson);
                AddVariablePresentationOptions(adapterLaunchInfoJson, launchJson);
            } catch (JsonReaderException) {
                // this should never happen
                Debug.Fail("adapterLaunchInfo is not valid json");
            }

This bug is caused by adapterLaunchInfo.LaunchJson being null, which I didn’t think could happen. Bad assumption on my part. I’ll get it fixed.

0reactions
AdamYoblickcommented, Jan 25, 2021

My comment was wrong, we definitely can read from the options page. The PR has been updated with the new logic to do so. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to launch debug adapter in Visual Studio 2022
It turns out that "/remote_debugger/vsdbg" is indeed missing. It is expected to be found in "C:\Users\username\vsdbg\vs2017u5" on the host.
Read more >
debug adapter failed to launch
When i click debug it gives a feedback that debug adapter failed to launch and also that session-1 timed waiting for debuggage to...
Read more >
Debug Python code - Visual Studio (Windows)
A debugging session starts with the Debug > Start Debugging command, the Start button on the toolbar, or the F5 key. These actions...
Read more >
Failed To Launch Debugger Visual Studio Python
If you hit this "Microsoft Visual Studio Failed to launch debug adapter" due to a ProtocolException when trying to debug a Blazor WebAssembly...
Read more >
Visual Studio Error: Failed to Launch Debug Adapter
The solution for this is to ensure you follow the debugging instructions linked above. Depending on your Visual Studio default configuration, another option ......
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