Strange error message in the immediate window

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
pemo18
Posts: 81
Joined: Fri Apr 27, 2018 10:38 am
Location: Germany

Strange error message in the immediate window

Post by pemo18 »

Hello X#-Community,

I am using the immediate window in Visual Studio (2017 with Bandol 2.41) a lot for debugging. So I am thankful for the recent improvements like being able to use the X# syntax instead of C#.

But there are still some limiations. Many times I have to deal with DataTables and DataColumns from the .NET 2.0 System.Data namespace.

If I have a Row-Variable which is a DataRow-object and a ColumnName-variable which is the name of the column:

Row[ColumName]:GetType().Name

This should give me the type of the column value for example.

Instead I'll get this:

error CS0019: Der --Operator kann nicht auf Operanden vom Typ "string" und "int" angewendet werden.

This is strange because there is no -- involved.

If I use the column index instead there is no error (please see attached screen shot)

Kind regards,
Peter
Attachments
XSharpImmediateWindowError_0207.jpg
XSharpImmediateWindowError_0207.jpg (53.29 KiB) Viewed 388 times
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Strange error message in the immediate window

Post by Chris »

Hi Peter,

I see the problem, this is because of an attempt to make the collection indexes 1-based, instead of 0-based which is the standard in .Net, by always subtracting 1 from the index, hence the error message about the "-" operator. But this is wrong, because this way oData:Columns[nIndex] would be actually translated to oData:Columns[nIndex-1], which would obviously return the wrong Column, so I think this needs to be removed.

In the particular case of the error that you get, you are using a string indexer instead of an int one, which the VS integration code does not realize and still tries to incorrectly subtract one. So it's two separate but related issues, I will log them for Robert to have a look, I suspect it will not be difficult to fix this. Thanks for your report!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
pemo18
Posts: 81
Joined: Fri Apr 27, 2018 10:38 am
Location: Germany

Strange error message in the immediate window

Post by pemo18 »

Hi Robert,

That would be a little but big improvement;)

Regards,
Peter
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Strange error message in the immediate window

Post by Chris »

He's fixed that already now :)
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply