瀏覽代碼

[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.
Atsushi Eno 10 年之前
父節點
當前提交
d2cdee078d
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs

+ 8 - 1
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 (