[System.Runtime.Serialization.Formatters.Soap] Updated to work with reference sources...
[mono.git] / mcs / class / System.Runtime.Serialization.Formatters.Soap / System.Runtime.Serialization.Formatters.Soap / SoapReader.cs
index 1b9e8eed40b96948dbd2621411e703ae6e2c386f..ccf2b2de79dc865614ed8233c6cae9b4a29d2acf 100644 (file)
@@ -735,9 +735,10 @@ namespace System.Runtime.Serialization.Formatters.Soap {
                {\r
                        if (parentObjectId == 0) indices = null;\r
 \r
-                       if (!objectInstance.GetType().IsValueType || parentObjectId == 0)\r
-                               objMgr.RegisterObject (objectInstance, objectId, info, 0, null, null);\r
-                       else\r
+                       if (!objectInstance.GetType ().IsValueType || parentObjectId == 0) {\r
+                               if (objMgr.GetObject(objectId) != objectInstance)\r
+                                       objMgr.RegisterObject (objectInstance, objectId, info, 0, null, null);\r
+                       } else\r
                        {\r
                                if(objMgr.GetObject(objectId) != null)\r
                                        throw new SerializationException("Object already registered");\r