Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use breakpoints in F# interactive?

I've started researching some ideas in algorithms using VS2010 and F# interactive.

So, I've created a DebugScript.fsx, I write some code there and eventually send it to F#Int to test it.

At some some moment I need to catch a bug. But I can't place a breakpoint even in a simple for loop:

for i in stringarray do
    printfn "%s" i

When I press F9 to set a breakpoint, the VS show a red circle with a warning sign. The hint for it is "The breakpoint will not currently be hit".

Surely, I did open Debug menu -> Attach to process ... -> Fsi.exe previously

I tried placing Debugger.Break() inside the loop, but that's the only line where debugger stops, giving me no option to proceed with debugging lines inside the loop. I also don't have any local variables available :(

Maybe I'm missing something obvious?

like image 934
bohdan_trotsenko Avatar asked Sep 06 '10 21:09

bohdan_trotsenko


People also ask

How do you use breakpoints in Javascript?

Set breakpoints at the line of codeClick the Sources tab. Browse the source file from the File navigation section. Go to the line of the code in the Code Editor section on the right. Click on the line number column to set a breakpoint on a line.

Can a debugger step over a function?

The functions still run, but the debugger skips over them. If the current line contains a function call, Step Over runs the code and then suspends execution at the first line of code after the called function returns.


1 Answers

in VS2015 is now much more easy: in Tools->Option->F# tools -> F# interactive-> Debugging -> Enable script debugging = True

then reset your interactive session and when you want to debug press CTRL+ALT+D and send command as usual

(or right click on the source file and choose "debug in interactive")

like image 77
Mosè Bottacini Avatar answered Nov 13 '22 21:11

Mosè Bottacini