XmlDeserialization error - Input string was not in a correct format

R

RJN

Hi

I'm getting an error while deserializing an xml into object.

[FormatException: Input string was not in a correct format.]
System.Number.ParseDouble(String s, NumberStyles style,
NumberFormatInfo info) +0
System.Double.Parse(String s, NumberStyles style, IFormatProvider
provider) +208
System.Xml.XmlConvert.ToDouble(String s)

How do I overcome this?

This is my deserializing code

XmlTextReader xtr = new XmlTextReader(oStream);
System.Xml.Serialization.XmlSerializer oSerializer = new
System.Xml.Serialization.XmlSerializer(typeof(ServicePartners));
ServicePartners objPartnerData =
(ServicePartners)oSerializer.Deserialize(xtr);

I was getting another error "String was not recognized as a valid time"
which I overacme by applying the attribute
[System.Xml.Serialization.XmlIgnoreAttribute()]. Is this the right way?

Regards

rjn
 
S

SunYour

You should problably use the IFormatProvider parameter ToDouble(string,
IFormatProvider)
Mabye you are trying to convert 3.1 when ToDouble needs 3,1 to work.

/Magnus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top