Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why F# debugger lies?

Can anyone explain me why debugger of VS2012 is showing different values for same member of object? (See the figure)

http://s2.uploads.ru/jlkw0.png (Sorry for nonEnglish interface of VS, but I think the situation is clear.)

Here the code:

http://pastie.org/7186239

like image 880
Vladimir Avatar asked Mar 30 '13 18:03

Vladimir


1 Answers

The debugging experience seems to do a poor job of identifying the correct binding for identifiers. In your example, this means that any identifier called Source is really showing the value of this.Source, rather than the corresponding property of the correct object. Note that you can get the right value by hovering over y and expanding the members (although this is obviously not a great experience).

There are even more confusing ways that this issue manifests itself:

type T() =
    member val P = 1

    member this.DoSomething() =
        let P = "test"      // set breakpoint here, hover over P
        printfn "%i" this.P // set breakpoint here, hover over P

T().DoSomething()

Now, whichever instance of P you hover over, you get the wrong thing!

like image 141
kvb Avatar answered Sep 19 '22 11:09

kvb