IndexOutOfRangeException

I am using Xml serialization to serialize a class. I use [XmlRoot()] to specify the root element and then I also implement IXmlSerializable to control the format of the serialization. I write attributes onto the document element and that works fine. Then i try to use WriteElementString to add a child element. Also if I try to use WriteStartElement it also throws IndexOutOfRangeException. I did not find much about this on the internet. What does this exception mean. I have very similar code, (the same functionally) in another project and it works fine. Any help would be great. Thanks.

Steve




Answer this question

IndexOutOfRangeException

  • Ertekin

    I will be happy to help with this problem, but I do need the code that throws. Laos the full stack trace will be usefull.

    Thanks,

    Elena


  • Rafael Rivera

    There is not enough information provided to tell what is wrong with the code.

    Please include full exception information (all inner exceptions + stack), this could be obtained by calling ToString() on the exception instance.

    Also a small repro woud be great.

    Thanks,

    Elena


  • IndexOutOfRangeException