Bug 693306

Summary: Failed to serialize private fields of base data contract.
Product: [Mono] Mono: Class Libraries Reporter: Roman Sakno <sakno>
Component: WCFAssignee: Atsushi Enomoto <atsushieno>
Status: NEW --- QA Contact: Mono Bugs <mono-bugs>
Severity: Major    
Priority: P5 - None    
Version: 2.10.x   
Target Milestone: ---   
Hardware: x86   
OS: Ubuntu   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Roman Sakno 2011-05-12 06:55:43 UTC
User-Agent:       Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

DataContractSerializer doesn't serialize private fields of all base data contracts. But public fields are serialized successfully.
Additional information is described in the following MSDN article:
http://msdn.microsoft.com/en-us/library/ms733127.aspx.
Citation:
"Member accessibility levels (internal, private, protected, or public) do not affect the data contract in any way".

Reproducible: Always

Steps to Reproduce:
1. Declare a new data contract named 'A' with private read-only field 'fa';
2. Derive another data contract 'B' from 'A'.
3. Create a new instance of 'B';
4. Serialize instance of 'B' with DataContractSerializer.
Actual Results:  
Normal serialization/deserialization.

Expected Results:  
Serialization/deserialization of public fields and fields declared at the top of data contract hierarchy.
Comment 1 Roman Sakno 2011-05-12 07:39:39 UTC
Correction: this issue is actual for JSON serialization/deserialization only(through DataContractJsonSerializer).