microsoft / vscode-mono-debug

A simple VS Code debug adapter for mono
Other
159 stars 173 forks source link

Breakpoints are not hitting while debugging F# console application in VSCode using Mono Debug extension #23

Open vrnithinkumar opened 7 years ago

vrnithinkumar commented 7 years ago

While trying to debug a f# console application the break points are not hitting, its just launching the application in VSCode debug mode and finishing the execution.

VS Code : 1.10.2 Mono Debug : 0.15.3

launch.json

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Launch",
            "type": "mono",
            "request": "launch",
            "program": "C:/FSharp/test/TestFharp/bin/Debug/TestFharp.exe",
            "args": ["Test Arg"],
            "cwd": "${workspaceRoot}",
            "preLaunchTask": "",
            "runtimeExecutable": null,
            "env": {},
            "externalConsole":false 
        },
        {
            "name": "Attach",
            "type": "mono",
            "request": "attach",
            "address": "localhost",
            "port": 55555
        }
    ]
}

DEBUG CONSOLE Output: mono --debug --debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:54579 C:/FSharp/test/TestFharp/bin/Debug/TestFharp.exe "Test Arg"

Link to Stack Overflow question : http://stackoverflow.com/questions/42929225/breakpoints-are-not-hitting-while-debugging-f-console-application-in-vscode-usi

weinand commented 7 years ago

@vrnithinkumar your launch.json contains two configurations: one for launching the target (name: "Launch"), one for attaching to an already launched target (name: "Attach"). They are independent from each other. From the debug console output I see that you are using the "Launch" launch configuration. In this launch configuration no "port" is specified and mono-debug will use a random port (54579 in your case). So there is no port mismatch.

How did you compile your F# program? Make sure that you compile it for debugging.

ghost commented 6 years ago

@weinand Maybe I have a similar issue.

I currently have this, it starts my app and it shows in the debug panel that threads are running but breakpoints don't work

{
            "name": "Launch",
            "type": "mono",
            "request": "launch",
            "program": "${workspaceRoot}/../Build/Client/SC_WebApp.exe",
            "args": ["--dev-mode", "--disable-ui"],
            "cwd": "${workspaceRoot}/../Build/Client/",
            "preLaunchTask": "Build",
            "runtimeExecutable": null,
            "env": {},
            "console": "integratedTerminal"
        }

image

ghost commented 6 years ago

And yes, in my case I am compiling my code before I run and it might also be worth noting that my code is C# not F#