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 ...
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: marcos.henrich
Depends on:
Reported: 2014-08-29 09:03 UTC by Matej Drolc
Modified: 2014-12-16 15:19 UTC (History)
3 users (show)

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

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.

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.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

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:choice minOccurs=""0"" maxOccurs=""unbounded"">
				  <xs:element name=""row"" msdata:Locale="""">
						<xs:element name=""r_CfgKeyPartForGridLayout"" type=""xs:string"" minOccurs=""0"" />
						<xs:element name=""r_FilterInputData"" type=""xs:string"" minOccurs=""0"" />
		  <diffgr:diffgram xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"" xmlns:diffgr=""urn:schemas-microsoft-com:xml-diffgram-v1"">
			  <row diffgr:id=""row1"" msdata:rowOrder=""0"">

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

		using (XmlReader r = xE.CreateReader())
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.
Comment 2 marcos.henrich 2014-12-16 15:19:24 UTC
Fixed in master c0216739390c37ea05a99a4cbc15e2222aac3f11.