muhammadsammy / free-vscode-csharp

Free/Libre fork of the official C# extension for vscode
https://open-vsx.org/extension/muhammad-sammy/csharp
Other
110 stars 10 forks source link

Read pipeTransport from launch.json when debugging #68

Closed granitrocky closed 1 month ago

granitrocky commented 1 month ago

Read the pipeTransport object from launch.json when launching the debugger. This enables the user to launch the debugger in a much more flexible way.

Example launch.json entry


{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "🕹 Debug Game",
        "type": "coreclr",
        "request": "launch",
        "preLaunchTask": "build",
        "program": "",
        "cwd": "${workspaceFolder}",
        "internalConsoleOptions": "openOnSessionStart",
        "pipeTransport": {
            "pipeCwd": "${workspaceFolder}",
            "pipeProgram": "bash",
            "pipeArgs": [
              "-c",
              "${debuggerCommand}",
              "--",
              "/usr/bin/godot"
            ],
            "debuggerPath": "/opt/netcoredbg/netcoredbg",
            "quoteArgs": true
        }
      }
   ]
}
dgokcin commented 1 month ago

hey @granitrocky I tried building your branch and installing the generated vsix for cursor.sh. Is just selecting "🕹 Debug Game" from the debug config and pressing the debug button enough for you to start debugging with breakpoints or you do something else?

thanks

granitrocky commented 1 month ago

Yeah that should be enough if you're using godot and it's installed at /usr/bin/godot on a linux system

dgokcin commented 1 month ago

haha using a mac and not using godot. I am trying to work around the limitations of vsdbg but so for I haven't been able to hit a breakpoint in a simple hello world console app :/

granitrocky commented 1 month ago

Do you have netcoredbg installed separately from the VSCodium extension? The example config points to netcoredbg in /opt/

dgokcin commented 1 month ago

yes I do. I have downloaded it under {workspaceFolder}/netcoredbg and I call it with the following launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": ".NET Core Launch (console) with pipeline",
      "type": "coreclr",
      "request": "launch",
      "preLaunchTask": "build",
      "program": "${workspaceFolder}/bin/Debug/net6.0/test.dll",
      "args": [],
      "cwd": "${workspaceFolder}",
      "stopAtEntry": false,
      "console": "internalConsole",
      "internalConsoleOptions": "openOnSessionStart",
      "logging": {
        "diagnosticsLog": {
          "protocolMessages": true
        }
      },
      "pipeTransport": {
          "pipeCwd": "${workspaceFolder}",
          "pipeProgram": "bash",
          "pipeArgs": [
            "-c",
          ],
          "debuggerPath": "${workspaceFolder}/netcoredbg/netcoredbg",
          "quoteArgs": true
        },
    },
    {
      "name": ".NET Core Attach",
      "type": "coreclr",
      "request": "attach",
      "processId": "${command:pickProcess}"
    }
  ]
}
dgokcin commented 1 month ago

@granitrocky I gathered both the debugger, launch.config and the tasks.json file under this repo. I would really appreciate it if you can give this setup a try. I am feeling like I am really close but still can not stop at the breakpoints :/

2024-05-31 10 59 59

granitrocky commented 1 month ago

@dgokcin I found a lot of issues with this implementation. There is a much better version at this PR: https://github.com/muhammadsammy/free-vscode-csharp/pull/72

Please read the notes and give that a shot