public void NestedReferenceNotAllowed()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
<xs:element name='Root' type='unusedType' msdata:IsDataSet='true'>
</xs:element>
<xs:complexType name='unusedType'>
<xs:sequence>
<xs:element name='Child' type='xs:string' />
</xs:sequence>
</xs:complexType>
<xs:element name='Foo'>
<xs:complexType>
<xs:sequence>
<xs:element ref='Root' />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>";
// DataSet element cannot be converted into a DataTable.
// (i.e. cannot be referenced in any other elements)
var ds = new DataSet();
Assert.Throws<ArgumentException>(() =>
{
ds.ReadXmlSchema(new StringReader(xs));
});
}