[Mono-bugs] [Bug 53024][Nor] New - Mono ignores <field_name>Specified in xml serialization.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 18 Jan 2004 10:30:26 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by erezl@mainsoft.com.

http://bugzilla.ximian.com/show_bug.cgi?id=53024

--- shadow/53024	2004-01-18 10:30:26.000000000 -0500
+++ shadow/53024.tmp.31471	2004-01-18 10:30:26.000000000 -0500
@@ -0,0 +1,76 @@
+Bug#: 53024
+Product: Mono/Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: erezl@mainsoft.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: Mono ignores <field_name>Specified in xml serialization.
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+In .NET you can create a pair of public fields as follows:
+1). A public field named aaaa of any type.
+2). A public boolean field named aaaaSpecified.
+
+If you apply the XmlIgnoreAttribute() on the aaaaSpecified field, then 
+during xml serialization, the Xml serializer checks the status of 
+aaaaSpecified. If aaaaSpecified == true, then the aaaa field is 
+serialized normally. If aaaaSpecified == false, then the aaaa field is 
+not serialized into the Xml stream.
+This behaviour is documented in the msdn at: 
+http://msdn.microsoft.com/library/default.asp?url=/library/en-
+us/cpref/html/frlrfsystemxmlserializationxmlignoreattributeclasstopic.asp
+
+
+Steps to reproduce the problem:
+1. Compile and run the following code sample:
+public class TestClass
+{
+	public int integerField;
+	[XmlIgnore()]
+	public bool integerFieldSpecified;
+}
+
+public class Deserializer
+{
+	static void Main(string[] args)
+	{
+		XmlSerializer serializer = new XmlSerializer(typeof
+(TestClass));
+		TestClass o = new TestClass();
+		o.integerField = 100;
+		o.integerFieldSpecified = false;
+		System.IO.TextWriter sout = Console.Out;
+		serializer.Serialize(sout, o);
+		sout.Close();
+	}
+}
+
+Actual Results:
+In Mono we get the following output:
+<?xml version="1.0"?>
+<TestClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <integerField>100</integerField>
+</TestClass>
+
+Expected Results:
+In .NET I get the following ouput:
+<?xml version="1.0"?>
+<TestClass xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
+
+How often does this happen? 
+Always.
+
+Additional Information: