Debugging F# app using VSCode, WSL2 + Extensions (Ionide Packet, FAKE, Core)

347 views Asked by At

You're getting this error when trying to debug an F# app on VSCode using Ionide

Unable to launch debugger worker process (vsdbg) through the terminal. spawn xterm ENOENT

enter image description here

1

There are 1 answers

0
Edward Casanova On
  1. Add a worskpace at the root folder of the app enter image description hsere

  2. Add a debug config (launch.json) -> Select template .NET Core Launch (console)

  3. Add a task for building the app -> You will be prompted to create this after you try to run the debugger following the previous step

  4. Run from debugger

enter image description here

Here's my example config, same fields but using them from the workspace file instead of directly under .vscode/* (personal preference)

     {
      "folders": [
        {
          "path": "."
        }
      ],
      "settings": {},
      "launch": {
        "version": "0.2.0",
        "configurations": [
          {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
// Change this path to point to your entrypoint
            "program": "${workspaceFolder}/bin/Debug/net6.0/hello-world.dll",
            "args": ["Hello"],
            "cwd": "${workspaceFolder}",
            "stopAtEntry": false,
            "console": "internalConsole"
          }
        ]
      },
      "tasks": {
        "version": "2.0.0",
        "tasks": [
          {
            "label": "build",
            "command": "dotnet",
            "type": "shell",
            "args": [
              "build",
              // Ask dotnet build to generate full paths for file names.
              "/property:GenerateFullPaths=true",
              // Do not generate summary otherwise it leads to duplicate errors in Problems panel
              "/consoleloggerparameters:NoSummary"
            ],
            "group": "build",
            "presentation": {
              "reveal": "silent"
            },
            "problemMatcher": "$msCompile"
          }
        ]
      }
    }

Unfortunately, I haven't been able to run it from the Ionide tab. Please let me know if you know how to solve this on WS2.

enter image description here

Related Questions in F#