Great.
Quote:I put a trace point on the "if(" row with the message: "Scale: {scaleConstant}".
Now Serial monitor displays the correct value (1107 in my case), while Expression analyzer always displays -1 for the scaleConstant variable.
The debugger uses the Arduino serial to send data so it will cater for any type of variable in the same way as if you typed Serial.println(myVar) into the source code.
I think what's going on here is related to a "quirk" of injected debugging and might be optional in future releases.
Currently the the sending of break point data is injected after the current statement has been completed, in the same way that you might add a Serial.print(myVar) after the line that calculates myVar.
If you put a breakpoint on the IF line, then the breakpoint/Serial has to be injected inside the { of the IF.
So in your case the value will always be -1 because the IF checks for -1
With injected breakpoints you can add them to blank lines, they are not really bound to the source code in the same way as a normal built-in Visual Studio debugger. This means you can add a breakpoint the line before where you have added it.
You can also add the breakpoint to the closing brace } of the IF() {, in which case the value will be reported after the entire IF has been processed.
Some experienced coders have asked why the breakpoints are not injected before the line begins. It's a complicated discussion that might become easier with a few new features due out soon. However all for another thread
Does this make sense?