[System.ServiceModel] Don't try to deserialize `void` messages.
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel.Dispatcher / BaseMessagesFormatter.cs
index 09fd46f5f45d8fe62150058479c6441b16b6f97f..64cf75b219b36f256406ca841eed6d9251d4d758 100644 (file)
@@ -325,11 +325,14 @@ namespace System.ServiceModel.Dispatcher
                        var l = new List<MessagePartDescription> (md.Body.Parts);
                        if (md.Body.ReturnValue != null)
                                l.Add (md.Body.ReturnValue);
-                       foreach (MessagePartDescription partDesc in l)
+                       foreach (MessagePartDescription partDesc in l) {
+                               if (partDesc.MemberInfo == null)
+                                       continue;
                                if (partDesc.MemberInfo is FieldInfo)
                                        parts [partDesc.Index] = ((FieldInfo) partDesc.MemberInfo).GetValue (msgObject);
                                else
                                        parts [partDesc.Index] = ((PropertyInfo) partDesc.MemberInfo).GetValue (msgObject, null);
+                       }
                }
 
                internal static bool HasReturnValue (MessageBodyDescription desc)
@@ -412,7 +415,7 @@ namespace System.ServiceModel.Dispatcher
                        for (r.MoveToContent (); r.NodeType == XmlNodeType.Element; r.MoveToContent ()) {
                                XmlQualifiedName key = new XmlQualifiedName (r.LocalName, r.NamespaceURI);
                                MessagePartDescription rv = md.Body.ReturnValue;
-                               if (rv != null && rv.Name == key.Name && rv.Namespace == key.Namespace)
+                               if (rv != null && rv.Name == key.Name && rv.Namespace == key.Namespace && rv.Type != typeof (void))
                                        parts [0] = ReadMessagePart (md.Body.ReturnValue, r);
                                else if (md.Body.Parts.Contains (key)) {
                                        MessagePartDescription p = md.Body.Parts [key];