[Mono-bugs] [Bug 661987] New: Using WCF DataContractSerializer to serialize object derived from DynamicObject is not throwing proper exception

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Jan 1 18:57:43 EST 2011


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

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


           Summary: Using WCF DataContractSerializer to serialize object
                    derived from DynamicObject is not throwing proper
                    exception
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.8.x
          Platform: 64bit
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: remoting
        AssignedTo: lluis at novell.com
        ReportedBy: curylod at asme.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=406689)
 --> (http://bugzilla.novell.com/attachment.cgi?id=406689)
Sample code for reproducing this bug.

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-us)
AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4

If I define a type that derives from System.Dynamic.DynamicObject, decorate
that with the WCF [DataContract] attribute, and attempt to serialize an
instance of this type using the WCF DataContractSerializer, I should get the
following exception, but on Mono, the object is serialized without exception. 
This behavior is inconsistent the the Microsoft .NET 4 runtime.

Unhandled Exception: System.Runtime.Serialization.InvalidDataContractException:
Type 'WCFDynamicObject.Dyn' cannot inherit from a type that is not marked with
DataContractAttribute or SerializableAttribute.  Consider marking the base type
'System.Dynamic.DynamicObject' with DataContractAttribute or
SerializableAttribute, or removing them from the derived type.

Reproducible: Always

Steps to Reproduce:
1. Create a valid WCF data contract, derived from System.Dynamic.DynamicObject,
as illustrated in the attached code sample.
2. Use the WCF DataContractSerializer to attempt to serialize this object.
Actual Results:  
No exception occurs.

Expected Results:  
Expecting this exception, as thrown under Microsoft .NET 4 runtime:

Unhandled Exception: System.Runtime.Serialization.InvalidDataContractException:
Type 'WCFDynamicObject.Dyn' cannot inherit from a type that is not marked with
DataContractAttribute or SerializableAttribute.  Consider marking the base type
'System.Dynamic.DynamicObject' with DataContractAttribute or
SerializableAttribute, or removing them from the derived type.

-- 
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