Consider this:
let hank = "hank"
let bill = "bill"
printfn "%A" hank // for breakpoint
Now if I set a conditional breakpoint in VS2015, condition being "hank = bill" (assuming F# expression) I get the following error:
The condition for a breakpoint failed to execute. The condition was 'hank = bill'. The error returned was 'The breakpoint condition must evaluate to a boolean operation'.
When the condition is "hank == bill" (maybe try C# expression?) the error is:
The condition for a breakpoint failed to execute. The condition was 'hank == bill'. The error returned was 'The runtime has refused to evaluate the expression at this time.'.
To set a conditional breakpointOn the Home tab, in the Breakpoints group, choose Set/Clear Condition. In the Debugger Breakpoint Condition window, enter a condition. On the Home tab, in the Breakpoints group, choose List. In the Debugger Breakpoint List window, enter a condition in the Condition column.
To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.
You can also set breakpoints on function names. To do this, just type "break [functionname]". gdb will stop your program just before that function is called.
The debugger uses C# syntax for conditions in breakpoints (in all versions of F# in Visual Studio, as far as I know), so the expression to use is hank == bill
. I certainly used conditional breakpoints in F# with VS 2015 - some assorted thoughts on what might help:
I think the debugger sometimes starts behaving oddly when you do too many things. Did you try to set the breakpoint in the second way after restarting the debugger?
Sometimes, setting breakpoints immediately on let
is a bit odd (the compiled code first initializes the variable to defaultof<'T>
). Can you try adding some no-op statement like printfn "test"
and setting conditional breakpoint on that?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With