[Mono-bugs] [Bug 682957] New: XmlElement deserialization failed with DataContractSerializer.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Mar 28 02:49:47 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=682957

https://bugzilla.novell.com/show_bug.cgi?id=682957#c0


           Summary: XmlElement deserialization failed with
                    DataContractSerializer.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.10.x
          Platform: x86
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: WCF
        AssignedTo: atsushi at ximian.com
        ReportedBy: sakno at tncor.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=421616)
 --> (http://bugzilla.novell.com/attachment.cgi?id=421616)
A source that repro an error and stack trace

User-Agent:       Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1;
Trident/5.0)

Unable to deserialize instance of data contract that contains XmlElement data
member. 
The following data contract can be serialized with DataContractSerializer, but
not deserialized:
[DataContract]
public class XmlSerializable
{
  [DataMember(Name = "Content")]
  private XmlElement m_content;

  public XmlElement Content
  {
    get { return m_content; }
    set { m_content = value; }
  }
}

Reproducible: Always

Steps to Reproduce:
Populates XmlSerializable::Content property with XML data, serializes instance
of XmlSerializable class and deserializes it again.
Actual Results:  
Unhandled Exception: System.InvalidOperationException: Failed to set value of
type System.String for property System.String InnerText --->
System.Reflection.TargetInvocationException: Exception has been thrown by the
target of an invocation. ---> System.NullReferenceException: Object reference
not set to an instance of an object

Expected Results:  
Successfully deserialized member with XmlElement type.

I think that DataContractSerializer implementation(on Mono) requires non-null
value of data member with XmlElement type when deserializing.
MSDN documentation describes this situation in strong form, with
On deserialization, an XmlElement is created by the deserializer from the
incoming XML.
This case is unambiguously treated by MSDN documentation:
"On deserialization, an XmlElement is created by the deserializer from the
incoming XML. A valid parent XmlDocument is provided by the deserializer."
http://msdn.microsoft.com/library/aa347876.aspx

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list