[Mono-list] How do you debug?

Miguel de Icaza miguel@ximian.com
04 Jul 2003 18:06:02 -0400


> Ok, it definitely looks like Mono being a little naughty but it's a simple 
> fix.
> The offending code is:
> uniqueId = reader.GetInt32(reader.GetOrdinal("RealContentItemId"));
> and the fix is:
> uniqueId = reader.GetOrdinal("RealContentItemId");
> It seems that GetOrdinal is returning an Int32 and we then try to convert to a 
> (wait for it) Int32. Mono should just ignore this code but it doesn't. 
> Actually, the programming team never should have written it like this, but 
> hey, Mono should handle this kind of stupidity.

Lets examine the problem a bit more, because I was as perplexed as you
were that a conversion from int to int would throw that exception.

What is happening here is that "reader.GetOrdinal
("RealContentItemId")" returns an integer.  

And here is the problem: the returned int is used as the ColumnValue
*key* whose value happens to be something different.

Am not a System.Data expert, but this is either a bug on the original
runtime, or there is a miss-conception in the
System.Data.SqlClient.GetValue code.

I added some extra information to the exception on CVS