[Mono-dev] System.Data.DataSet ReadXml question

Atsushi Eno atsushi at ximian.com
Fri Sep 9 03:00:20 EDT 2005

Hi again,

I found an interesting fact that MS.NET 1.x treats such row values
of inconvertible columns as System.String. The attached example
shows you what happens there on MS.NET 1.x

On .NET 2.0 it throws an exception as Mono does. So it really
seems MS bug in 1.x.

Atsushi Eno

Atsushi Eno wrote:
> Hi,
> Chris Micacchi wrote:
>> I have a program that creates a DataTable with a column of type 
>> System.Version, and then writes out the dataset containing the table 
>> to an XML file using DataSet.WriteXml().  The resulting file looks 
>> fine, but when I then use DataSet.ReadXml() to re-read the data back 
>> into the dataset, I get this:
>> Unhandled Exception: System.InvalidCastException: Unknown target 
>> conversion type
>> in <0x0065c> System.Convert:ToType (System.Object value, System.Type 
>> conversionType, IFormatProvider provider)
>> in <0x00032> System.Convert:ChangeType (System.Object value, 
>> System.Type conversionType)
>> in <0x0030e> System.Data.XmlDataReader:StringToObject (System.Type 
>> type, System.String value)
>> in <0x001d3> System.Data.XmlDataReader:ReadElementElement 
>> (System.Data.DataRow row)
>> ....
>> It looks like it's trying to convert the stringified version number 
>> back to a System.Version and hitting a brick wall.  Am I doing 
>> something wrong here?  I've attached a small sample program that hits 
>> this problem for me, in case it helps.  Compile it with
>>     mcs datasettest.cs -out:datasettest.exe -r:System.Data
> Yes, kinda wrong. System.Version is not documented as a supported
> datatype:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/
> cpref/html/frlrfsystemdatadatacolumnclassdatatypetopic.asp
> My guess is that for such input type that is not listed on the
> list shown in above page MS.NET checks whether the type has a
> constructor which takes a string.
> I'll take care it and possibly fix the code after 1.1.9 release.
> Atsushi Eno
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: really-typed.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050909/0fa633b3/attachment.pl 

More information about the Mono-devel-list mailing list