Created
February 1, 2011 20:35
-
-
Save radical/806598 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/BasicProfileChecker.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/BasicProfileChecker.cs | |
index c9d73c2..e862414 100644 | |
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/BasicProfileChecker.cs | |
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/BasicProfileChecker.cs | |
@@ -142,7 +142,7 @@ namespace System.Web.Services.Description | |
public override void Check (ConformanceCheckContext ctx, BindingCollection value) { | |
foreach (Binding b in value) | |
- foreach (ServiceDescriptionFormatExtension ext in b.Extensions) | |
+ foreach (object ext in b.Extensions) | |
if (ext.GetType () == typeof (SoapBinding)) | |
return; | |
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs | |
index fb0aab5..eee8a30 100644 | |
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs | |
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs | |
@@ -339,8 +339,13 @@ namespace System.Web.Services.Description | |
void AddExtensionNamespaces (XmlSerializerNamespaces ns, ServiceDescriptionFormatExtensionCollection extensions) | |
{ | |
- foreach (ServiceDescriptionFormatExtension ext in extensions) | |
+ foreach (object o in extensions) | |
{ | |
+ ServiceDescriptionFormatExtension ext = o as ServiceDescriptionFormatExtension; | |
+ if (ext == null) | |
+ // o can be XmlElement, skipping that | |
+ continue; | |
+ | |
ExtensionInfo einf = ExtensionManager.GetFormatExtensionInfo (ext.GetType ()); | |
foreach (XmlQualifiedName qname in einf.NamespaceDeclarations) | |
ns.Add (qname.Name, qname.Namespace); | |
@@ -352,8 +357,12 @@ namespace System.Web.Services.Description | |
ServiceDescriptionFormatExtensionCollection extensions = ExtensionManager.GetExtensionPoint (ob); | |
if (extensions != null) | |
{ | |
- foreach (ServiceDescriptionFormatExtension ext in extensions) | |
- WriteExtension (writer, ext); | |
+ foreach (object o in extensions) { | |
+ if (o is ServiceDescriptionFormatExtension) | |
+ WriteExtension (writer, (ServiceDescriptionFormatExtension)o); | |
+ else if (o is XmlElement) | |
+ ((XmlElement)o).WriteTo (writer); | |
+ } | |
} | |
} | |
diff --git a/mcs/class/System.Web.Services/Test/System.Web.Services.Description/ServiceDescriptionTest.cs b/mcs/class/System.Web.Services/Test/System.Web.Services.Description/ServiceDescriptionTest.cs | |
index 7ebfc51..99fe6c6 100644 | |
--- a/mcs/class/System.Web.Services/Test/System.Web.Services.Description/ServiceDescriptionTest.cs | |
+++ b/mcs/class/System.Web.Services/Test/System.Web.Services.Description/ServiceDescriptionTest.cs | |
@@ -141,6 +141,14 @@ namespace MonoTests.System.Web.Services.Description | |
Assert.AreEqual (typeof (SoapAddressBinding), sd.Services [0].Ports [0].Extensions [0].GetType ()); | |
CheckXmlElement (sd.Services [0].Ports [0].Extensions [1], "portElem"); | |
+ string out_file = Path.GetTempFileName (); | |
+ try { | |
+ using (FileStream out_fs = new FileStream(out_file, FileMode.Create)) | |
+ sd.Write (out_fs); | |
+ } finally { | |
+ if (!String.IsNullOrEmpty (out_file)) | |
+ File.Delete (out_file); | |
+ } | |
} | |
void CheckExtensions (DocumentableItem di, string elemName, string val) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment