locked
BTS2016 JSON Encoder StackOverflowException with circular referencing schema RRS feed

  • Question

  • Hi,

    While in the process of testing a custom pipeline component which inherits the default JSON encoder component, i got the rather unpretty StackOverflowException. Reverse engineering the BizTalk JSON encoder lead me to the 'Newtonsoft.Json.Utilities.SchemaInformation' object. When it builds a new SchemaInformation object, based of an XmlSchema object, it never completes building the SchemaInformation object.

    It took me a while before i realized it was caused by a circular reference in an XSD. The creation of the SchemaInformation never ends since it keeps stacking up the reference circle which resides in the XmlSchema object. 

    Part of the problematic XSD in the XmlSchema object has a reference structure like this:

     <xs:group name="grp1">
        <xs:sequence>
          <xs:group ref="t:grp2" />
        </xs:sequence>
      </xs:group>
    
      <xs:group name="grp2">
        <xs:sequence>
          <xs:element minOccurs="0" name="elem2">
            <xs:complexType>
              <xs:group ref="t:grp1" />
            </xs:complexType>
          </xs:element>
        </xs:sequence>
      </xs:group>

    I'm not sure if this is valid or non valid by XSD definition: "Circular groups are disallowed. That is, within the {particles} of a group there must not be at any depth a particle whose {term} is the group itself."

    I get mixed answers when finding an answer to this, some people explain that by the 'particle definition', my XSD is technically valid.

    Anyway, valid or non valid XSD, in my opinion BizTalk should at least:

    • Warn me of the potential disaster. I did not get any warnings in the Schema project during building or deploying.
    • Not throw a StackOverflowException and rather throw the circular reference exception. 





    • Edited by Erwin K Friday, February 17, 2017 7:20 PM
    Friday, February 17, 2017 6:54 PM

All replies

  • Bump.

    As a side note, it also just happens when using the JSON encoder directly in a pipeline, not only when referencing it in another component. 

    I would like to hear from the BizTalk team if is this will be addressed or not. 


    Saturday, March 4, 2017 4:28 PM