It looks that F# debugger doesn't work properly in VS 2015. Let me illustrate it on simple console program:
let f1 =
printf "hello 1"
printf "hello 2" //1
[<EntryPoint>]
let main argv =
f1 //2
0
I set breakpoints on lines //1 and //2 and start the debugger.
First BP being hit is //1 while it should have been //2. Why is that?
Also at this moment I cannot navigate to the topmost level of the callstack. I.e. when I double click on the callstack entry which should have navigate me to line //2 VS tells me that "Source Not Available". Why is that?
These two problems doesn't stop me from debugging but nevertheless make pretty unhappy.
First BP being hit is //1 while it should have been //2. Why is that?
f1
is not a function, it is a value of type unit. So its value is going to be constructed before main
is called. You'll note that if you call f1
multiple times, it only prints once because the value has been initialized. If you change f1
to this:
let f1() = //etc
Then it will behave as you expect.
I suspect your callstack issue is because you are expecting main
to be called before f1
's initializer, which isn't correct.