[WCF] similar to Binary writer fixes, do not close Text writer.
authorAtsushi Eno <atsushieno@gmail.com>
Mon, 20 Apr 2015 13:17:22 +0000 (22:17 +0900)
committerAtsushi Eno <atsushieno@gmail.com>
Fri, 24 Apr 2015 05:36:59 +0000 (14:36 +0900)
Just like BinaryMessageFormatter needed to use another CreateBinaryWriter()
overload to NOT close the input stream, use CreateTextWriter() overload that
does not close the stream.

mcs/class/System.ServiceModel.Web/System.ServiceModel.Channels/WebMessageEncoder.cs

index 380b054468a5dcfc7f6ec2811ab4457ce43cf9a8..b438b10968481216020eb087dce8d5b0e6b6a0f6 100644 (file)
@@ -178,12 +178,12 @@ namespace System.ServiceModel.Channels
                                using (XmlWriter w = XmlDictionaryWriter.CreateDictionaryWriter (XmlWriter.Create (new StreamWriter (stream, source.WriteEncoding))))
                                        message.WriteMessage (w);
 #else
-                               using (XmlWriter w = XmlDictionaryWriter.CreateTextWriter (stream, source.WriteEncoding))
+                               using (XmlWriter w = XmlDictionaryWriter.CreateTextWriter (stream, source.WriteEncoding, false))
                                        message.WriteMessage (w);
 #endif
                                break;
                        case WebContentFormat.Json:
-                               using (XmlWriter w = JsonReaderWriterFactory.CreateJsonWriter (stream, source.WriteEncoding))
+                               using (XmlWriter w = JsonReaderWriterFactory.CreateJsonWriter (stream, source.WriteEncoding, false))
                                        message.WriteMessage (w);
                                break;
                        case WebContentFormat.Raw: