diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Schema/FacetChecker.cs b/src/libraries/System.Private.Xml/src/System/Xml/Schema/FacetChecker.cs
index 050a82464d99c..7be724ebc779b 100644
--- a/src/libraries/System.Private.Xml/src/System/Xml/Schema/FacetChecker.cs
+++ b/src/libraries/System.Private.Xml/src/System/Xml/Schema/FacetChecker.cs
@@ -334,6 +334,13 @@ internal void CompileFractionDigitsFacet(XmlSchemaFacet facet)
{
throw new XmlSchemaException(SR.Sch_FractionDigitsFacetInvalid, SR.Sch_FractionDigitsNotOnDecimal, facet);
}
+ if ((_baseFixedFlags & RestrictionFlags.FractionDigits) != 0)
+ {
+ if (_datatype.Restriction.FractionDigits != _derivedRestriction.FractionDigits)
+ {
+ throw new XmlSchemaException(SR.Sch_FacetBaseFixed, facet);
+ }
+ }
if ((_baseFlags & RestrictionFlags.FractionDigits) != 0)
{
if (_derivedRestriction.FractionDigits > _datatype.Restriction.FractionDigits)
diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Compile.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Compile.cs
index aafe321747fb9..83ac7b192991c 100644
--- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Compile.cs
+++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Compile.cs
@@ -152,6 +152,7 @@ public void TFS_470021()
}
[Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
public void FractionDigitsMismatch_Throws()
{
string schema = @"
@@ -159,7 +160,7 @@ public void FractionDigitsMismatch_Throws()
xmlns:xs='http://www.w3.org/2001/XMLSchema'>
-
+
@@ -178,6 +179,32 @@ public void FractionDigitsMismatch_Throws()
Assert.DoesNotContain("totalDigits", ex.Message);
}
+ [Fact]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
+ public void FractionDigitsFacetBaseFixed_Throws()
+ {
+ string schema = @"
+
+
+
+
+
+
+
+
+
+
+
+
+";
+ XmlSchemaSet ss = new XmlSchemaSet();
+ ss.Add(null, XmlReader.Create(new StringReader(schema)));
+
+ Exception ex = Assert.Throws(() => ss.Compile());
+ Assert.Contains("fixed", ex.Message);
+ }
+
[Fact]
public void MinLengthLtBaseMinLength_Throws()
{