Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

XmlElement is not marked as serializable (unhelpful BCL error)

Back to Forum: Tech Off
  • User profile image
    androidi

    I think this could be more helpful than it is..

    An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll

    Additional information: Type 'System.Xml.XmlElement' in Assembly 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.

    To realize how unhelpful this is, see:

    https://gist.github.com/anonymous/55be94e18fd8200e116dbcef6d6184ff

    That's the class that previously (de)serialized just fine with the BCL BinaryFormatter.

     

    edit: Turns out the query filling in the fields is now filling in a new field of XmlAnyElement (anyField), previously it was null.

     

  • User profile image
    androidi

    I'll admit that I don't know is it possible that this error could be caused by some change in the service that fills the data. (edit: seems so!)

  • User profile image
    androidi

    Turns out the query filling in the fields is now filling in a new field of XmlAnyElement (anyField), previously it was null.

    I just set it to null as I don't need it, easy alternative solution might be to switch from binary to xmlserializer.

    It's also possible that the reference.cs needs to be updated and that would solve the problem. ie. maybe the new unrecognized fields end up in the anyField.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.