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.

Support Child Process Debugging

See original GitHub issue

launch configuration looks something like

 {
        "name": ".NET Debug Tool",
        "type": "coreclr",
        "request": "launch",
        "program": "dotnet",
        "args": [
            "tool",
            "run",
            "{toolname}"
        ],
        "cwd": "${workspaceRoot}",
        "stopAtEntry": true,
        "externalConsole": false,
        "justMyCode": false,

        "symbolOptions": {
            "searchNuGetOrgSymbolServer": true
        }
    }

I supect this is becauase tools are launched as a child process i.e: dotnet tool run "toolname" will with local manifest i.e. resolve tool in nuget cache and start a new process something like dotnet.exe C:\Users\{user}\.nuget\packages\{toolname}\{version}\tools/{framework moniker}/any/{tool}.dll

If change to launch C:\Users\{user}\.nuget\packages\{toolname}\{version}\tools/{framework moniker}/any/{tool}.dll directly debugging works directly from F5 but that doesn’t scale between machines and how tools are resolved arent super obvious.

Is there anything avail/planned like Node.JS autoAttachChildProcesses?

Attaching manually works, but that also requires .NET tool to wait for debugger.

If manually attaching is only option it would be nice if it could be automated i.e. i could expose child process id in console output so if there were something serverReadyAction where the action wasn’t openExternally but something like

"serverReadyAction": {
    "action": "attachDebugger",
    "pattern": "\\bAttach debugger to process\\s([0-9]+)\\b to continue\\.\\.\\.",
}

To find a pattern like Attach debugger to process xxxxx to continue...

In full Visual Studio it works by installing the Microsoft Child Process Debugging Power Tool

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gregg-miskellycommented, Oct 27, 2020

I will leave this issue open to track doing the work to consume https://github.com/dotnet/runtime/issues/43924 in this extension.

1reaction
gregg-miskellycommented, Oct 27, 2020

Current the Child Process Debugging Power Tool is currently the only way to do this. I opened https://github.com/dotnet/runtime/issues/43924 – the .NET team has had this request many times before, but it doesn’t seem like anyone opened a GitHub issue for it, so I fixed that.

If you are on Windows, using Visual Studio + the Child Process Debugging Power Tool is probably your best option. If you are not on Windows, I would probably recommend adding some sort of command line switch or environment variable that caused your code to do:

    while (!Debugger.IsAttached) Thread.Sleep(100);

Then you can attach.

I like your idea on serverReadyAction but this extension doesn’t own serverReadyAction. I think you would file such a suggestion against the VS Code team.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Microsoft Child Process Debugging Power Tool
Power tool to add child process debugging to Visual Studio. ... This extension allows Visual Studio to automatically debug child processes (new ...
Read more >
Introducing the Child Process Debugging Power Tool
We've heard your feedback that you want the Visual Studio debugger to support child process debugging. Child process debugging means that ...
Read more >
Can Visual Studio be made to debug child processes like ...
In WinDBG, I can use the .childdbg 1 command to tell it to break when a child process is spawned, or I can...
Read more >
Debugging a child process
To debug the child process, include a call to sleep() in the code that the child process executes after the fork(). It may...
Read more >
Debugging Child Processes on Windows - mesos-log - GitHub
Debug Mesos Child Process · Select Debug -> Other Debug Targets -> Child Process Debugging Settings ... · Check Enable Child Process Debugging...
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