Bug 27910 - XmlParserContext Constructor not throwing XmlException when it should
Summary: XmlParserContext Constructor not throwing XmlException when it should
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.16.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Ankit Jain
URL:
Depends on:
Blocks:
 
Reported: 2015-03-11 14:21 UTC by nader
Modified: 2015-03-16 09:31 UTC (History)
1 user (show)

Tags:
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 Developer Community or GitHub 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:
Status:
RESOLVED FIXED

Description nader 2015-03-11 14:21:27 UTC
When calling XmlParserContext(XmlNameTable nt, XmlNamespaceManager nsMgr,string xmlLang,XmlSpace xmlSpace) Constructor with a XmlNameTable nt that wasn't used to Construct XmlNamespaceManager nsMgr, Based on MSDN documentation
(https://msdn.microsoft.com/en-us/library/xc8bact5(v=vs.110).aspx) an XmlException has to be thrown. However, this doesn't happen to be the case when running on Xamarin Android:

To reproduce run the following code snippet:
try
{
System.Xml.NameTable v0 =  new System.Xml.NameTable();
System.Xml.NameTable v13 =  new System.Xml.NameTable();
System.Xml.XmlNamespaceManager v14 =  new System.Xml.XmlNamespaceManager((System.Xml.XmlNameTable)v13);
System.Xml.XmlParserContext v21 = new System.Xml.XmlParserContext((System.Xml.XmlNameTable)v0, (System.Xml.XmlNamespaceManager)v14, null, System.Xml.XmlSpace.None);
return -1;
}
catch (System.Xml.XmlException e)
{
return 0;
}


Expected output: XmlException. returns 0
Xamarin Android output: No exception is thrown. returns -1

The Windows Phone 8.1 version of this correctly throws an XmlExcetpion.

This code snippet was placed in a PCL project and was run on an android 4.4.2
emulator and a Windows Phone 8.1 emulator

Additional Build Environment info:
Xamarin.Android Version: 4.16.0 (Business Edition)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
Comment 1 Ankit Jain 2015-03-16 07:11:57 UTC
This wasn't specific to Android. And is fixed now, with the referencesource implementation.
Comment 2 Ankit Jain 2015-03-16 09:31:58 UTC
Note: this should be fixed as of ~ 50db47379083f823d0942870468df1fcda971f97 . This was tested with f482b9bd9b890cd99c3b93872a337b2b65f8f12b though.