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
Strange error message in the immediate window
Strange error message in the immediate window
- Attachments
-
- XSharpImmediateWindowError_0207.jpg (53.29 KiB) Viewed 394 times
Strange error message in the immediate window
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!
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
XSharp Development Team
chris(at)xsharp.eu
Strange error message in the immediate window
Hi Robert,
That would be a little but big improvement;)
Regards,
Peter
That would be a little but big improvement;)
Regards,
Peter
Strange error message in the immediate window
He's fixed that already now
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu