Author: lluis
Date: 2005-07-14 05:38:31 -0400 (Thu, 14 Jul 2005)
New Revision: 47296

Modified:
   trunk/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
   
trunk/mcs/class/System.XML/System.Xml.Serialization/SerializationCodeGenerator.cs
Log:
2005-07-14  Lluis Sanchez Gual  <[EMAIL PROTECTED]>

        * SerializationCodeGenerator.cs: In the generated serializer always
        use the Object equality operator when comparing objects to serialize
        to null, since those objects may have the equality operator
        overloaded. This fixes bug #75543.



Modified: trunk/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Serialization/ChangeLog       
2005-07-14 08:40:33 UTC (rev 47295)
+++ trunk/mcs/class/System.XML/System.Xml.Serialization/ChangeLog       
2005-07-14 09:38:31 UTC (rev 47296)
@@ -1,3 +1,10 @@
+2005-07-14  Lluis Sanchez Gual  <[EMAIL PROTECTED]>
+
+       * SerializationCodeGenerator.cs: In the generated serializer always
+       use the Object equality operator when comparing objects to serialize
+       to null, since those objects may have the equality operator
+       overloaded. This fixes bug #75543.
+
 2005-07-01  Lluis Sanchez Gual  <[EMAIL PROTECTED]>
 
        * XmlCustomFormatter.cs: Properly read/write duration values.

Modified: 
trunk/mcs/class/System.XML/System.Xml.Serialization/SerializationCodeGenerator.cs
===================================================================
--- 
trunk/mcs/class/System.XML/System.Xml.Serialization/SerializationCodeGenerator.cs
   2005-07-14 08:40:33 UTC (rev 47295)
+++ 
trunk/mcs/class/System.XML/System.Xml.Serialization/SerializationCodeGenerator.cs
   2005-07-14 09:38:31 UTC (rev 47296)
@@ -565,7 +565,7 @@
                        
                        if (!typeMap.TypeData.IsValueType)
                        {
-                               WriteLine ("if (ob == null)");
+                               WriteLine ("if (((object)ob) == null)");
                                WriteLineInd ("{");
                                WriteLineInd ("if (isNullable)");
                                
@@ -1053,7 +1053,7 @@
                        bool multichoice = (map.ItemInfo.Count > 1);
 
                        if (multichoice)
-                               WriteLine ("if (" + item + " == null) { }");
+                               WriteLine ("if (((object)" + item + ") == null) 
{ }");
                        
                        foreach (XmlTypeMapElementInfo info in map.ItemInfo)
                        {
@@ -1976,7 +1976,7 @@
                        else
                        {
                                if (list != null) {
-                                       WriteLineInd ("if (" + list + " == 
null)");
+                                       WriteLineInd ("if (((object)" + list + 
") == null)");
                                        WriteLine ("throw 
CreateReadOnlyCollectionException (" + GetLiteral (typeMap.TypeFullName) + 
");");
                                        Unindent ();
                                        WriteLineInd ("if (!ReadNull()) {");
@@ -1984,7 +1984,7 @@
                                else {
                                        list = GetObTempVar ();
                                        WriteLine (typeMap.TypeFullName + " " + 
list + " = null;");
-                                       WriteLineInd ("if (" + list + " == 
null)");
+                                       WriteLineInd ("if (((object)" + list + 
") == null)");
                                        WriteLine ("throw 
CreateReadOnlyCollectionException (" + GetLiteral (typeMap.TypeFullName) + 
");");
                                        Unindent ();
                                        return list;
@@ -2080,7 +2080,7 @@
                        }
                        else    // Must be IEnumerable
                        {
-                               WriteLine ("if (" + list + " == null)");
+                               WriteLine ("if (((object)" + list + ") == 
null)");
                                if (canCreateInstance) 
                                        WriteLine ("\t" + list + " = new " + 
listType.FullTypeName + "();");
                                else 
@@ -2105,7 +2105,7 @@
                                string metName = GetFillListName (td);
                                WriteLine ("void " + metName + " (object list, 
object source)");
                                WriteLineInd ("{");
-                               WriteLine ("if (list == null) throw 
CreateReadOnlyCollectionException (" + GetLiteral (td.FullTypeName) + ");");
+                               WriteLine ("if (((object)list) == null) throw 
CreateReadOnlyCollectionException (" + GetLiteral (td.FullTypeName) + ");");
                                WriteLine ("");
 
                                WriteLine (td.FullTypeName + " dest = (" + 
td.FullTypeName + ") list;");

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to