[Mono-list] How do you debug?
Fri, 4 Jul 2003 23:54:12 +0100
=2D----BEGIN PGP SIGNED MESSAGE-----
On Friday 04 Jul 2003 11:06 pm, Miguel de Icaza wrote:
> > Ok, it definitely looks like Mono being a little naughty but it's a
> > simple fix.
> > The offending code is:
> > uniqueId =3D reader.GetInt32(reader.GetOrdinal("RealContentItemId"));
> > and the fix is:
> > uniqueId =3D reader.GetOrdinal("RealContentItemId");
> > It seems that GetOrdinal is returning an Int32 and we then try to conve=
> > 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 li=
> > 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.
Correct, an Int32 to be exact IIRC. MSDN has the following definition:
public virtual int GetOrdinal(
and the GetInt32 function is:
public virtual int GetInt32(
Now that's not what I'd call a useful function to start with...they're goin=
to convert an int to an int??? In any case, it works on MS platform and=20
doesn't for Mono.
> And here is the problem: the returned int is used as the ColumnValue
> *key* whose value happens to be something different.
The returned int is indeed used as a column key. This key is then used to=20
return the actual value of the column...now this is weird. I seem to recall=
from the tests that the value coming back from GetInt32 was not the actual=
value that the table held but may have been the column index instead. Now=20
I'll have to go write that code again and find out, because looking at the=
MSDN reveals that the GetInt32 should have return the contents of the field=
not the column ID.
I'll keep you informed...
> 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
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
=2D----END PGP SIGNATURE-----