xmlserializer throwing InvalidOperationException
Posted
by AndyC
on Stack Overflow
See other posts from Stack Overflow
or by AndyC
Published on 2010-03-26T10:32:35Z
Indexed on
2010/03/26
10:43 UTC
Read the original article
Hit count: 191
I have an XmlSerializer object, and I have added 2 event handlers to the UnknownElement and UnknownAttribute events, as below:
XmlSerializer xs = new XmlSerialiser(typeof(MyClass));
xs.UnknownAttribute += new XmlAttributeEventHandler(xs_UnknownAttribute);
xs.UnknownElement += new XmlElementEventHandler(xs_UnknownAttribute);
Each of these event handlers basically do the same thing, they print out the node name or the attribute name causing the issue.
But for some reason, an InvalidOperationException is getting thrown saying there is an error in the xml document with . I thought these errors would be caught by my events?
© Stack Overflow or respective owner