input string was not in a correct format in Class

Rinaldo 336 Reputation points

I know this error, try to parse string into int for example.

I've made a .CS class file against Paste Special in the edit menu of VS 2017. On dat moment no problem is I import the XML file where I imported the class file from. If I take another XML file it fail with the error input string was not in a correct format. I do nothing know about serilisation but I suspect the following lines:



    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true,
        Namespace = "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2")]

    [System.Xml.Serialization.XmlRootAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2",
        IsNullable = false)]


bij System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
bij System.Number.ParseUInt32(String value, NumberStyles options, NumberFormatInfo numfmt)
bij Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderInvoice.Read14_Item(Boolean isNullable, Boolean checkType)
bij Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderInvoice.Read15_AccountingSupplierPartyParty(Boolean isNullable, Boolean checkType)
bij Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderInvoice.Read16_AccountingSupplierParty(Boolean isNullable, Boolean checkType)
bij Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderInvoice.Read45_Invoice(Boolean isNullable, Boolean checkType)
bij Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderInvoice.Read46_Invoice()

Somebody knows this serialisation error?
Greetings Rinaldo

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
6,994 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. P a u l 7,566 Reputation points

    If the issue is that you have two XML files and you've generated a class from the first, but the second doesn't deserialise into it, then I'd recommend generating a class from your second file too & then put both classes into something like this so you can see the differences more clearly: