From: Atsushi Eno Date: Mon, 20 Apr 2015 07:07:42 +0000 (+0900) Subject: [WCF] XmlReader from GetReaderAtBodyContents() should not be missing xmlns-es. X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=d2cdee078dbcd25cc65aafd6e591a23020c8e7ba;p=mono.git [WCF] XmlReader from GetReaderAtBodyContents() should not be missing xmlns-es. The namespace declarations existed when the entire Message is read but not in the partial body contents. They caused regressions when we use serialization stack from referencesource. It is possible that more namespaces may be requied, but we will be importing System.ServiceModel later on and then the issue will go away. So far we don't want regression as long as they show up in our NUnit tests. --- diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs index ec14a780bb0..f67ce5dd8ad 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs @@ -258,9 +258,16 @@ namespace System.ServiceModel.Channels WriteBodyContents (body); } + var nt = new NameTable (); + var nsmgr = new XmlNamespaceManager (nt); + nsmgr.AddNamespace ("s", Version.Envelope.Namespace); + nsmgr.AddNamespace ("a", Version.Addressing.Namespace); + var pc = new XmlParserContext (nt, nsmgr, null, XmlSpace.None); + var rs = new XmlReaderSettings (); rs.ConformanceLevel = ConformanceLevel.Auto; - return XmlDictionaryReader.CreateDictionaryReader (XmlReader.Create (new StringReader (sw.ToString ()), rs)); + + return XmlDictionaryReader.CreateDictionaryReader (XmlReader.Create (new StringReader (sw.ToString ()), rs, pc)); } protected abstract void OnWriteBodyContents (