Skip to content

Timeout waiting for debugger connection to running pythonnet process #1463

Open
@s-seele

Description

@s-seele

Environment data

  • debugpy version: 1.8.0
  • OS and version: Windows 11, Version 10.0.22621, Build 22621
  • Python version (& distribution if applicable, e.g. Anaconda): >=3.11
  • Using VS Code or Visual Studio: VS Code 1.84.2, python extension v2023.20.0

Actual behavior

The debugger is unable to attach, giving the following error message:
Timed out waiting for debug server to connect

Expected behavior

The debugger successfully attaches to the running process.

Steps to reproduce:

We're running python scripts from within a .NET application using pythonnet 3.0.3. To enable the VS Code debugger to connect to our process, we do the following before the actual script is run:
import sys import time while not sys.gettrace(): time.sleep(0.1)

We use the following launch.json to attach to the process:
{ "name": "Attach Script Debugger", "type": "python", "request": "attach", "processId": "${command:pickProcess}", "justMyCode": true }

Using this approach, it has been possible to attach the debugger to our process up until Python 3.10. Nothing changed other than that we upgraded to pythonnet 3.0.3 from 3.0.1 and that we used a different Python version. Attaching to the debugger still works for 3.10 with the upgraded pythonnet library.

I also tried adding "subProcess": true and "timeout": 300000 to the launch.json as well as changing the default terminal to Cmd.exe and setting "python.terminal.activateEnvironment" to false, as suggested in other issues.

The respective Python version is added to the system PATH variable and matches the selected interpreter in VS Code.
pythonVSCodeVersion

Here are the logfiles, but they don't seem to be very helpful.
debugger.vscode_forPython311.log
debugpy.adapter_forPython311.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions