Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6098795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:11:55+00:00 2026-05-23T13:11:55+00:00

I am having trouble finding why the following XML won’t deserialize. Message: There is

  • 0

I am having trouble finding why the following XML won’t deserialize.

Message:

There is an error in XML document (23, 26).

Inner exception:

Input string was not in a correct format.

Calling Code (works without issue on everything except the XML below):

Public Shared Function DeserializeObject(Of T)(ByVal serializedXml As String) As T
    Dim serializer As New XmlSerializer(GetType(T))

    Using strReader As New IO.StringReader(serializedXml)
        Return DirectCast(serializer.Deserialize(strReader), T)
    End Using

End Function

XML (looks ok – issue is after the first open square bracket of DiscountCode):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MyResponse>
    <Shoppinglist>
        <ShoppinglistName>ShoppingListName</ShoppinglistName>
        <Currency>GBP</Currency>
        <PriceType>Retail</PriceType>
        <Orders>
            <Order>
                <OrderLineId>Test</OrderLineId>
                <Completed>false</Completed>
                <Description>Other Item</Description>
                <Quantity>1</Quantity>
                <Parts>
                    <Part>
                        <PartId>43543543435</PartId>
                        <Description>Cylinder Assy - Master</Description>
                        <PriceInclTax>92.16</PriceInclTax>
                        <PriceExclTax>76.8</PriceExclTax>
                        <Quantity>1</Quantity>
                        <TaxRate>20.0</TaxRate>
                        <NetDiscountCode>ZZ</NetDiscountCode>
                        <SurchargeQuantity>1.0</SurchargeQuantity>
------------->          <DiscountRate>0.0</DiscountRate>
                    </Part>
                </Parts>
            </Order>
        </Orders>
    </Shoppinglist>
    <ReturnCode>1</ReturnCode>
    <StatusMessage>Open tasks exist</StatusMessage>
</MyResponse>

Can anyone see what is wrong?

Stack trace (for outer exception):

 at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
 at System.Xml.Serialization.XmlSerializer.Deserialize(TextReader textReader)

Stack trace for inner exception:

 at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)    
 at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)    
 at System.Xml.XmlConvert.ToInt32(String s)    

Which is strange, as it looks like it is parsing to Int, when it should be parsing to decimal…

property for class T:

Protected _DiscountRate As Decimal
Public Property DiscountRate() As Decimal
    Get
        Return _DiscountRate
    End Get
    Set(ByVal Value As Decimal)
        _DiscountRate = Value
    End Set
End Property

I added the following, but it didn’t make any difference:

<System.Xml.Serialization.XmlElement(Type:=GetType(Decimal))> _

I doubt this is to do with strange characters as I can’t see any. Also changing the type to Double does not work around the problem. Any other ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:11:56+00:00Added an answer on May 23, 2026 at 1:11 pm

    It turns out the problem was with a property, however, I was so busy looking at what the error message was saying, I missed it. The error message pointed to the wrong property!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble finding the error in the following code: #include <stdio.h> #define LOOP
I'm having trouble finding a regular expression that matches the following String. Korben;http://feeds.feedburner.com/KorbensBlog-UpgradeYourMind?format=xml;1 One
I'm having trouble finding an open-source IDE with support for Git. Are there any
I'm trying to compile this program and I'm having trouble finding the following files
I am having trouble finding the correct refactor option for the following scenario: I
I'm having trouble finding it in the CPAN documentation -- is there a way
I've been having trouble finding the right design pattern for the following situation: I'm
I'm having trouble finding the right selector for nested ULs. I have the following
I am finding trouble in having Devise responding correctly to a JSON message. the
I'm having trouble finding any resource for adding ctrl-z undo capability to a Flex

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.