one-based array and VS debugger
- kevclark64
- Posts: 127
- Joined: Thu Aug 15, 2019 7:30 pm
- Location: USA
one-based array and VS debugger
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
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
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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
- kevclark64
- Posts: 127
- Joined: Thu Aug 15, 2019 7:30 pm
- Location: USA
one-based array and VS debugger
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.
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
Yeah, that should be possible as well I think. It's just one of the many items to be done...
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu