From b44333823da53df777fa53def4fcd2de8a9b131f Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Sun, 19 Nov 2017 15:43:06 +0300 Subject: XmlReaderSettings.EnableLegacyXmlSettings should always be false on mono. Fixes bug-60621 (#6014) --- .../XmlDsigC14NTransformTest.cs | 19 ++++++++++--------- .../XmlDsigC14NWithCommentsTransformTest.cs | 21 +++++++++++---------- .../XmlDsigExcC14NTransformTest.cs | 19 ++++++++++--------- .../Test/System.Xml/XmlReaderSettingsTests.cs | 12 +++++++++++- .../System.Xml/nist_dom/fundamental/Attr/Attr.cs | 2 ++ .../fundamental/NamedNodeMap/NamedNodeMap.cs | 3 ++- .../corlib/ReferenceSources/BinaryCompatibility.cs | 2 ++ 7 files changed, 48 insertions(+), 30 deletions(-) (limited to 'mcs/class') diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs index 6e04748f906..0e660e75068 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs @@ -245,16 +245,17 @@ namespace MonoTests.System.Security.Cryptography.Xml { Assert.AreEqual (C14NSpecExample4Output, res, "Example 4 from c14n spec - Character Modifications and Character References (without comments)"); } - [Test] - public void C14NSpecExample5 () - { - using (StreamWriter sw = new StreamWriter ("world.txt", false, Encoding.ASCII)) { - sw.Write ("world"); - sw.Close (); + [Test] + [Ignore(".NET DOM implementation does not match W3C DOM specification.")] + public void C14NSpecExample5 () + { + using (StreamWriter sw = new StreamWriter ("world.txt", false, Encoding.ASCII)) { + sw.Write ("world"); + sw.Close (); + } + string res = ExecuteXmlDSigC14NTransform (C14NSpecExample5Input); + Assert.AreEqual (C14NSpecExample5Output, res, "Example 5 from c14n spec - Entity References (without comments)"); } - string res = ExecuteXmlDSigC14NTransform (C14NSpecExample5Input); - Assert.AreEqual (C14NSpecExample5Output, res, "Example 5 from c14n spec - Entity References (without comments)"); - } [Test] public void C14NSpecExample6 () diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs index 2eea71d0ce4..a6530464d10 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs @@ -160,18 +160,19 @@ namespace MonoTests.System.Security.Cryptography.Xml { Assert.AreEqual (C14NSpecExample4Output, res, "Example 4 from c14n spec - Character Modifications and Character References (with comments)"); } - [Test] - public void C14NSpecExample5 () - { - if (!File.Exists ("world.txt")) { - using (StreamWriter sw = new StreamWriter ("world.txt", false, Encoding.ASCII)) { - sw.Write ("world"); - sw.Close (); + [Test] + [Ignore(".NET DOM implementation does not match W3C DOM specification.")] + public void C14NSpecExample5 () + { + if (!File.Exists ("world.txt")) { + using (StreamWriter sw = new StreamWriter ("world.txt", false, Encoding.ASCII)) { + sw.Write ("world"); + sw.Close (); + } } + string res = ExecuteXmlDSigC14NTransform (C14NSpecExample5Input, false); + Assert.AreEqual (C14NSpecExample5Output, res, "Example 5 from c14n spec - Entity References (with comments)"); } - string res = ExecuteXmlDSigC14NTransform (C14NSpecExample5Input, false); - Assert.AreEqual (C14NSpecExample5Output, res, "Example 5 from c14n spec - Entity References (with comments)"); - } [Test] public void C14NSpecExample6 () diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigExcC14NTransformTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigExcC14NTransformTest.cs index 69e38cf8178..25db0267ad6 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigExcC14NTransformTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigExcC14NTransformTest.cs @@ -339,16 +339,17 @@ namespace MonoTests.System.Security.Cryptography.Xml { Assert.AreEqual (ExcC14NSpecExample4Output, res, "Example 4 from c14n spec - Character Modifications and Character References (without comments)"); } - [Test] - public void ExcC14NSpecExample5 () - { - using (StreamWriter sw = new StreamWriter ("world.txt", false, Encoding.ASCII)) { - sw.Write ("world"); - sw.Close (); + [Test] + [Ignore(".NET DOM implementation does not match W3C DOM specification.")] + public void ExcC14NSpecExample5 () + { + using (StreamWriter sw = new StreamWriter ("world.txt", false, Encoding.ASCII)) { + sw.Write ("world"); + sw.Close (); + } + string res = ExecuteXmlDSigExcC14NTransform (ExcC14NSpecExample5Input); + Assert.AreEqual (ExcC14NSpecExample5Output, res, "Example 5 from c14n spec - Entity References (without comments)"); } - string res = ExecuteXmlDSigExcC14NTransform (ExcC14NSpecExample5Input); - Assert.AreEqual (ExcC14NSpecExample5Output, res, "Example 5 from c14n spec - Entity References (without comments)"); - } [Test] public void ExcC14NSpecExample6 () diff --git a/mcs/class/System.XML/Test/System.Xml/XmlReaderSettingsTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlReaderSettingsTests.cs index 768cd5671da..2b20f06e971 100644 --- a/mcs/class/System.XML/Test/System.Xml/XmlReaderSettingsTests.cs +++ b/mcs/class/System.XML/Test/System.Xml/XmlReaderSettingsTests.cs @@ -14,7 +14,7 @@ using System.Text; using System.Xml; using System.Xml.Schema; using NUnit.Framework; - +using System.Reflection; using ValidationFlags = System.Xml.Schema.XmlSchemaValidationFlags; using AssertType = NUnit.Framework.Assert; @@ -443,5 +443,15 @@ namespace MonoTests.System.Xml var r2 = XmlReader.Create (r, c); Assert.IsTrue (r2.Settings.Async); } + + [Test] + public void LegacyXmlSettingsAreDisabled () + { + // Make sure LegacyXmlSettings are always disabled on Mono + // https://bugzilla.xamarin.com/show_bug.cgi?id=60621 + var enableLegacyXmlSettingsMethod = typeof(XmlReaderSettings).GetMethod ("EnableLegacyXmlSettings", + BindingFlags.NonPublic | BindingFlags.Static); + Assert.IsFalse ((bool) enableLegacyXmlSettingsMethod.Invoke (null, null)); + } } } diff --git a/mcs/class/System.XML/Test/System.Xml/nist_dom/fundamental/Attr/Attr.cs b/mcs/class/System.XML/Test/System.Xml/nist_dom/fundamental/Attr/Attr.cs index 78fef4a73ee..27313d0c8af 100644 --- a/mcs/class/System.XML/Test/System.Xml/nist_dom/fundamental/Attr/Attr.cs +++ b/mcs/class/System.XML/Test/System.Xml/nist_dom/fundamental/Attr/Attr.cs @@ -482,6 +482,7 @@ namespace nist_dom.fundamental //---------------------------------------------------------------------------- [Test] + [Ignore(".NET DOM implementation does not match W3C DOM specification.")] public void core0009A() { string computedValue = "";//0; @@ -595,6 +596,7 @@ namespace nist_dom.fundamental //---------------------------------------------------------------------------- [Test] + [Ignore(".NET DOM implementation does not match W3C DOM specification.")] public void core0011A() { string computedValue = "";//""; diff --git a/mcs/class/System.XML/Test/System.Xml/nist_dom/fundamental/NamedNodeMap/NamedNodeMap.cs b/mcs/class/System.XML/Test/System.Xml/nist_dom/fundamental/NamedNodeMap/NamedNodeMap.cs index eb4b3ddb71c..5f415070f42 100644 --- a/mcs/class/System.XML/Test/System.Xml/nist_dom/fundamental/NamedNodeMap/NamedNodeMap.cs +++ b/mcs/class/System.XML/Test/System.Xml/nist_dom/fundamental/NamedNodeMap/NamedNodeMap.cs @@ -453,7 +453,8 @@ namespace nist_dom.fundamental //---------------------------------------------------------------------------- [Test] - public void core0008M() + [Ignore(".NET DOM implementation does not match W3C DOM specification.")] + public void core0008M() { string computedValue = ""; string expectedValue = "False"; diff --git a/mcs/class/corlib/ReferenceSources/BinaryCompatibility.cs b/mcs/class/corlib/ReferenceSources/BinaryCompatibility.cs index 77351195ca9..746d3783dc7 100644 --- a/mcs/class/corlib/ReferenceSources/BinaryCompatibility.cs +++ b/mcs/class/corlib/ReferenceSources/BinaryCompatibility.cs @@ -4,5 +4,7 @@ namespace System.Runtime.Versioning { public static readonly bool TargetsAtLeast_Desktop_V4_5 = true; public static readonly bool TargetsAtLeast_Desktop_V4_5_1 = true; + // should be a property for System.Xml.BinaryCompatibility + public static bool TargetsAtLeast_Desktop_V4_5_2 => true; } } \ No newline at end of file -- cgit v1.2.3