diff options
author | Atsushi Eno <atsushi@ximian.com> | 2011-04-18 12:20:22 +0400 |
---|---|---|
committer | Atsushi Eno <atsushi@ximian.com> | 2011-04-18 12:22:21 +0400 |
commit | a9777b31fc9bfb9d021c6132933de20de7364fc5 (patch) | |
tree | a725a4ef3a666310564721322cf182244c644c76 | |
parent | 7dcacbb5bffe2a2076dc4c3c32d751d5efb7f90d (diff) |
Empty XmlReader message caused failure on buffereed copy.
-rw-r--r-- | mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs | 5 | ||||
-rw-r--r-- | mcs/class/System.ServiceModel/System.ServiceModel.Channels/XmlReaderBodyWriter.cs | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs index b99365a3b55..e3faf3e7db8 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs @@ -106,7 +106,10 @@ namespace System.ServiceModel.Channels ReadBodyStart (); var headers = new MessageHeaders (Headers); var props = new MessageProperties (Properties); - return new DefaultMessageBuffer (maxBufferSize, headers, props, new XmlReaderBodyWriter (reader), IsFault, attributes); + if (IsEmpty) + return new DefaultMessageBuffer (headers, props, attributes); + else + return new DefaultMessageBuffer (maxBufferSize, headers, props, new XmlReaderBodyWriter (reader), IsFault, attributes); } protected override string OnGetBodyAttribute ( diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/XmlReaderBodyWriter.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/XmlReaderBodyWriter.cs index 81ad6dd6dc8..f619cda64d1 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/XmlReaderBodyWriter.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/XmlReaderBodyWriter.cs @@ -58,6 +58,8 @@ namespace System.ServiceModel.Channels : base (false) { reader.MoveToContent (); + if (reader.NodeType != XmlNodeType.Element) + throw new InvalidOperationException ("Argument XmlReader is expected to be positioned at element"); this.reader = reader; } |