Bug? Debug and Release do not evaluate the same


Well-Known Member
Licensed User
Dim P As Panel   
P.Tag = Crsr.GetDouble("QcL_Dimension")
            If GoNoGo Then
                'Log(P.Tag & "  " & (P.Tag = -1))
                If P.Tag = -1 Then
                    P.top = MeanLine.top - Size * 1.1
                    P.Color = Colors.Black
                    P.top = MeanLine.top + Size * 1.1
                    P.Color = Colors.Red
                End If

In the code above I am storing a datapoint in P.Tag. In some cases this is True/False rather than a dimension so it is storing 0 or -1.

In debug mode
P.Tag = -1
returns true.
In Release Mode it Returns False.

When I change it to
If P.Tag = -1.0 Then
it works in both

Log(P.Tag) Prints -1 in debug and -1.0 in Release.
Breaking the code in debug and HOVERING over P.Tag DISPLAYS -1.0 even though it LOGS -1.

The bigger concern of course is -1 should equal -1.0 regardless.


Well-Known Member
Licensed User
It happens because P.Tag is an Object and it fails when the numeric value is a double instead of an int.
You should change your code to:
Dim i As Int = p.Tag
If i = -1 Then
This way it will work in all cases.
I did that. Just wanted to let you know it works in debug, not in release.
But that brings up a question. I was assuming that it failed because P.tag is something like -.99999999 and not truly -1. Is that true or is it because they are simply different data types?