How to set conditional breakpoint when debugging F # in Visual Studio

Consider this:

let hank = "hank" let bill = "bill" printfn "%A" hank // for breakpoint 

Now, if I set a conditional breakpoint in VS2015, the condition is "hank = bill" (assuming an F # expression), I get the following error:

The condition for the breakpoint failed. The condition was 'hank = bill'. Return error: 'The breakpoint condition must evaluate before the boolean operation'.

When the condition is "hank == bill" (maybe try a C # expression?), The error is:

The condition for the breakpoint failed. The condition was 'hank == bill'. An error was detected: "Runtime refused to evaluate the expression at this time.

+6
source share
1 answer

The debugger uses C # syntax for conditions at breakpoints (in all versions of F # in Visual Studio, as far as I know), so the expression used is hank == bill . I definitely used conditional breakpoints in F # with VS 2015 - some different thoughts on what might help:

  • I think that the debugger sometimes starts to behave strangely when you do too many things. Did you try to set a breakpoint in the second way after restarting the debugger?

  • Sometimes setting breakpoints immediately on let bit odd (compiled code first initializes the variable to defaultof<'T> ). Can you try to add some no-op operator, such as printfn "test" , and set a conditional breakpoint on this?

+4
source

Source: https://habr.com/ru/post/1013112/


All Articles