Search code examples
f#visual-studio-codeionide

How do I set up the visual studio code launch.json file to debug F#?


How do I set up the debugger in launch.json?

Currently, I have

{
    "version": "0.1.0",
    "configurations": [
        {
            // Name of configuration
            // Appears in the launch configuration drop down menu.
            "name": "Launch Lukecxu",
            "request": "launch",
            "cwd": "/Users/lukexu/lukecxu",
            "type": "node",
            // Automatically stop program after launch.
            "stopOnEntry": true,
            "program": "${workspaceRoot}" 
        }
    ]
}

I found some of this online but it's not working. It said I should have "type" as mono but when I set it has mono it said type not supported.

For my system settings I did brew install mono and I also have ionide installed.

Right now I can't click the gutter to set any break points and when I hit F5 it says "Cannot launch program '/Users/lukexu/lukecxu'; configuring source maps might help."

Is there a tutorial to set up F# debugger in VSCode?


Solution

  • I think that you need to install mono debug extension

    After you've installed extension following configuration should work:

    {
        "version": "0.1.0",
        "configurations": [
            {
                // optional "preLaunchTask": "Build" - some way of building your application.
                "externalConsole": true, 
                "name": "Launch",
                "type": "mono",
                // Workspace relative or absolute path to the program.
                "program": "${workspaceRoot}/bin/myapp/myapp.exe",
                "stopOnEntry": true
            },
            {
                "name": "Attach",
                "request": "attach",
                "type": "mono",
                "address": "localhost",
                "port": 55555
            }
        ]
    }