one-based array and VS debugger

This forum is meant for questions about the Visual FoxPro Language support in X#.

Post Reply
User avatar
kevclark64
Posts: 127
Joined: Thu Aug 15, 2019 7:30 pm
Location: USA

one-based array and VS debugger

Post 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.
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

one-based array and VS debugger

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
kevclark64
Posts: 127
Joined: Thu Aug 15, 2019 7:30 pm
Location: USA

one-based array and VS debugger

Post 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.
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

one-based array and VS debugger

Post by Chris »

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 test
chris(at)xsharp.eu
Post Reply