Sfoglia il codice sorgente

Return null for empty message in WebMessageFormatter. Useful eror messages.

Atsushi Eno 14 anni fa
parent
commit
8a8df8387b

+ 5 - 2
mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs

@@ -169,7 +169,7 @@ namespace System.ServiceModel.Dispatcher
 				throw new ArgumentNullException ("messageVersion");
 
 			if (!MessageVersion.None.Equals (messageVersion))
-				throw new ArgumentException ("Only MessageVersion.None is supported");
+				throw new ArgumentException (String.Format ("Only MessageVersion.None is supported. {0} is not.", messageVersion));
 		}
 
 		protected MessageDescription GetMessageDescription (MessageDirection dir)
@@ -197,7 +197,7 @@ namespace System.ServiceModel.Dispatcher
 #endif
 				return json_serializer;
 			default:
-				throw new NotImplementedException ();
+				throw new NotImplementedException (msgfmt.ToString ());
 			}
 		}
 
@@ -359,6 +359,9 @@ namespace System.ServiceModel.Dispatcher
 					throw new ArgumentNullException ("parameters");
 				CheckMessageVersion (message.Version);
 
+				if (message.IsEmpty)
+					return null; // empty message, could be returned by HttpReplyChannel.
+
 				string pname = WebBodyFormatMessageProperty.Name;
 				if (!message.Properties.ContainsKey (pname))
 					throw new SystemException ("INTERNAL ERROR: it expects WebBodyFormatMessageProperty existence");