Bug 22501 - XmlSchema.Read raises InvalidElementError for certain inputs which work fine in MS.NET
Summary: XmlSchema.Read raises InvalidElementError for certain inputs which work fine ...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: marcos.henrich
URL:
Depends on:
Blocks:
 
Reported: 2014-08-29 09:03 UTC by Matej Drolc
Modified: 2014-12-16 15:19 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Matej Drolc 2014-08-29 09:03:17 UTC
Here is a program example with xml input from a real application that throws an Exception in Mono but works fine in MS.NET.

using System;
using System.Data;
using System.Linq;
using System.Xml;
using System.Xml.Linq;

class Program
{
	static void Main(string[] args)
	{
		string xml = @"<Databag DataBagName="""" GridDataId="""" StartRow=""0"" RowCount=""1"">
		  <xs:schema id=""NewDataSet"" xmlns="""" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"">
			<xs:element name=""NewDataSet"" msdata:IsDataSet=""true"" msdata:MainDataTable=""row"" msdata:Locale="""">
			  <xs:complexType>
				<xs:choice minOccurs=""0"" maxOccurs=""unbounded"">
				  <xs:element name=""row"" msdata:Locale="""">
					<xs:complexType>
					  <xs:sequence>
						<xs:element name=""r_CfgKeyPartForGridLayout"" type=""xs:string"" minOccurs=""0"" />
						<xs:element name=""r_FilterInputData"" type=""xs:string"" minOccurs=""0"" />
					  </xs:sequence>
					</xs:complexType>
				  </xs:element>
				</xs:choice>
			  </xs:complexType>
			</xs:element>
		  </xs:schema>
		  <diffgr:diffgram xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"" xmlns:diffgr=""urn:schemas-microsoft-com:xml-diffgram-v1"">
			<DocumentElement>
			  <row diffgr:id=""row1"" msdata:rowOrder=""0"">
				<r_FilterInputData></r_FilterInputData>
			  </row>
			</DocumentElement>
		  </diffgr:diffgram>
		</Databag>";

		XElement xE = XElement.Parse(xml);		
		DataTable dt = new DataTable();

		using (XmlReader r = xE.CreateReader())
		{
			dt.ReadXmlSchema(r);
		}				
	}
}
Comment 1 marcos.henrich 2014-10-13 16:11:11 UTC
Hi Matej,

Thank you for the detailed bug report.

The pull request for this issue can be found in the link below.
https://github.com/mono/mono/pull/1336
Comment 2 marcos.henrich 2014-12-16 15:19:24 UTC
Fixed in master c0216739390c37ea05a99a4cbc15e2222aac3f11.
https://github.com/mono/mono/commit/c0216739390c37ea05a99a4cbc15e2222aac3f11

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.


Create a new report for Bug 22501 on Developer Community or GitHub if you have new information to add and do not yet see a matching report.

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments


Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Related Links: