-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue #51778 and add more test coverage for xs:restrictions. #51779
Conversation
Tagging subscribers to this area: @buyaa-n, @krwq Issue DetailsImplemented a simple fix which is to remove the check below:
from the following method as it is actually bogus. In the xsd:restriction case the number of immediate child particles in the sequence or in the choice cannot be compared like this since GetMappingParticle is actually recursive. private bool IsSequenceFromChoice(XmlSchemaSequence derivedSequence, XmlSchemaChoice baseChoice)
{
decimal minOccurs, maxOccurs;
minOccurs = derivedSequence.MinOccurs * derivedSequence.Items.Count;
if (derivedSequence.MaxOccurs == decimal.MaxValue)
{
maxOccurs = decimal.MaxValue;
}
else
{
maxOccurs = derivedSequence.MaxOccurs * derivedSequence.Items.Count;
}
if (!IsValidOccurrenceRangeRestriction(minOccurs, maxOccurs, baseChoice.MinOccurs, baseChoice.MaxOccurs)
|| derivdSequence.Items.Count > baseChoice.Items.Count)
{
return false;
}
for (int i = 0; i < derivedSequence.Items.Count; ++i)
{
if (GetMappingParticle((XmlSchemaParticle)derivedSequence.Items[i], baseChoice.Items) < 0)
return false;
}
return true;
}
|
Thanks @lovettchris ! |
Some tests failed eg
|
src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_ProhibitDTD.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_ProhibitDTD.cs
Show resolved
Hide resolved
Hmmm, I seem to be hitting some unrelated tests failures, see above, complaining about System.IO.FileSystem.Watcher.Tests in job 550598f7-547a-4211-b618-e4799eb70970 has failed? And an infrustructure issue saying "##[error].packages/microsoft.dotnet.helix.sdk/6.0.0-beta.21222.1/tools/Microsoft.DotNet.Helix.Sdk.MultiQueue.targets(78,5): error : (NETCORE_ENGINEERING_TELEMETRY=Test) Work item System.IO.FileSystem.Watcher.Tests in job 550598f7-547a-4211-b618-e4799eb70970 has failed." ? |
That test failure is #30056 which @carlossanlop is working on a fix for. So your PR validation is clean. Just need @krwq to sign off. |
Thank you @lovettchris! |
Fixes #51778
Implemented a simple fix which is to remove the check below:
from the following method as it is actually bogus. In the xsd:restriction case the number of immediate child particles in the sequence or in the choice cannot be compared like this since GetMappingParticle is actually recursive.