Selaa lähdekoodia

[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 vuotta sitten
vanhempi
sitoutus
d2cdee078d

+ 8 - 1
mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs

@@ -258,9 +258,16 @@ namespace System.ServiceModel.Channels
 				WriteBodyContents (body);
 				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 ();
 			var rs = new XmlReaderSettings ();
 			rs.ConformanceLevel = ConformanceLevel.Auto;
 			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 (
 		protected abstract void OnWriteBodyContents (