Page 1 of 1
one-based array and VS debugger
Posted: Fri Jan 17, 2020 7:33 pm
by kevclark64
VFP uses one-based arrays, which is the default setting for the Foxpro dialect in X#. However, when viewing an array in the Visual Studio debugger, the first element is listed as the 0th element. For a 2-dimensional array, the first element is 0,0 rather than 1,1. This would not be too much of a problem if one were viewing an entire array in the debugger since it would be obvious it was starting with 0. However, if one had a watch on something like MyArray[1] or MyArray(i) the watch window would report an incorrect value for that particular item for any one-based array.
one-based array and VS debugger
Posted: Fri Jan 17, 2020 8:16 pm
by wriedmann
Hi Kevin,
also VO used 1-based arrays, but C# and the .NET world use 0-based arrays.
And since the VS Debugger is a piece of Microsoft software, I have my doubts the development team has any chance to change this.
Wolfgang
one-based array and VS debugger
Posted: Fri Jan 17, 2020 9:05 pm
by kevclark64
What's interesting though is if you have the following code:
local iArray[2] as int
iArray[1]=1
if you hover your cursor over the "[1]" in iArray{1] the debugger will correctly report the value of iArray[1] as 1. However, if you hover over "iArray" and drill down to Elements then it will show element [0] as 1 and element [1] as null. Similarly, if you add iArray[1] to the watch window it will show null. So, it seems that XSharp is doing something to the VS debugger to make it give the correct answer when hovering over the "[1]", which makes me think it is at least possible that the other values might be similarly shown correctly.
one-based array and VS debugger
Posted: Sat Jan 18, 2020 9:21 am
by Chris
Yeah, that should be possible as well I think. It's just one of the many items to be done...