2009-08-11 Gonzalo Paniagua Javier <gonzalo@novell.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 11 Aug 2009 15:09:11 +0000 (15:09 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 11 Aug 2009 15:09:11 +0000 (15:09 -0000)
* DefaultWsdlHelpGenerator.aspx: the 'Message Layout' can now handle
self-referencing types. Fixes bug #529353.

svn path=/trunk/mono/; revision=139712

data/net_2_0/ChangeLog
data/net_2_0/DefaultWsdlHelpGenerator.aspx

index 09f2a8259689851077b997088df268ed836055e1..d925a1e415a6ff1019647e8ad35e7ceca8d21bbe 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-11 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+       * DefaultWsdlHelpGenerator.aspx: the 'Message Layout' can now handle
+       self-referencing types. Fixes bug #529353.
+
 2009-08-05  Atsushi Enomoto  <atsushi@ximian.com>
 
        * web.config: add WCF assemblies as references at compilation.
index 6d02af355e92f793da5a5d8c627f2551e6a90601..4750b01f14183e0027074ea016abe52286636197 100644 (file)
@@ -10,6 +10,7 @@
 --%>
 
 <%@ Import Namespace="System.Collections" %>
+<%@ Import Namespace="System.Collections.Generic" %>
 <%@ Import Namespace="System.IO" %>
 <%@ Import Namespace="System.Xml.Serialization" %>
 <%@ Import Namespace="System.Xml" %>
@@ -1035,7 +1036,7 @@ public class HtmlSampleGenerator: SampleGenerator
                        if (elem == null) throw new InvalidOperationException ("Element not found: " + qname);
                        WriteElementSample (xtw, qname.Namespace, elem);
                }
-               
+
                void WriteElementSample (XmlTextWriter xtw, string ns, XmlSchemaElement elem)
                {
                        bool sharedAnnType = false;
@@ -1129,9 +1130,18 @@ public class HtmlSampleGenerator: SampleGenerator
                {
                        WriteAttributes (xtw, stype.Attributes, stype.AnyAttribute);
                }
-               
+
+               Dictionary<XmlSchemaComplexType,int> recursed_types = new Dictionary<XmlSchemaComplexType,int> ();
                void WriteComplexTypeElements (XmlTextWriter xtw, string ns, XmlSchemaComplexType stype)
                {
+                       int prev = 0;
+                       if (recursed_types.ContainsKey (stype))
+                               prev = recursed_types [stype];
+
+                       if (prev > 1)
+                               return;
+                       recursed_types [stype] = ++prev;
+
                        if (stype.Particle != null)
                                WriteParticleComplexContent (xtw, ns, stype.Particle);
                        else
@@ -1141,6 +1151,8 @@ public class HtmlSampleGenerator: SampleGenerator
                                else if (stype.ContentModel is XmlSchemaComplexContent)
                                        WriteComplexContent (xtw, ns, (XmlSchemaComplexContent)stype.ContentModel);
                        }
+                       prev = recursed_types [stype];
+                       recursed_types [stype] = --prev;
                }
 
                void WriteAttributes (XmlTextWriter xtw, XmlSchemaObjectCollection atts, XmlSchemaAnyAttribute anyat)