-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Xml resources have invalid formatter #30218
Comments
Seems like there are 13 invalid cases:
found by navigating to raw view https://raw.githubusercontent.com/dotnet/corefx/master/src/System.Private.Xml/src/Resources/Strings.resx and in the Firefox's console, running: // edit: works in other new-gen browsers
[... // spread operator to convert NodeList to Array object
new DOMParser()
.parseFromString(
document
.querySelector('body > pre').innerText, 'text/xml')
.documentElement.childNodes
].filter(node => node.querySelector && node.querySelector('data > value') &&
/\{(\d*[a-zA-Z\s]+\d*)+\}/.test(node.querySelector('data > value').textContent))
.map(node =>
`${node.getAttribute('name')}: ${node.querySelector('data > value').textContent}`)
.join('\n') |
@am11 I've done it with just regex: |
It was just to capture mixed cases like |
So if some In other projects, I've sometimes had a |
BTW, I see these strings look the same in .NET Framework. I do not believe this meets the bar for 3.0 at this point (assuming it's even a bug and it isn't somehow meant to be this way) |
I'd like to tackle this as a first contribution. I was not able to find any way to claim this issue. I think I need to be added for this to be assigned to me. I've created pull request #33890 for one of the 13 resources for feedback before tackling all of them. |
Hi @mrj001 glad to have you on board. I assigned you this issue. |
* Added test for Issue 30218, use of resource Sch_MinLengthGtBaseMinLength * Reworded error message to remove the invalid formatters. Issue #30218 * Updated check of message from the exception to be more amenable to potential internationalization. * Reworded resource Sch_MaxLengthGtBaseMaxLength and added unit test for same. * Simplified test code per feedback from Dan Moseley, PR#33890. * Tests to increase code coverage. The ones that are failing trigger resource string Sch_MaxMinLengthBaseLength to be used as the Exception message. * Removed invalid formatters from the resource string Sch_MaxMinLengthBaseLength. Failing tests from the previous commit now pass. * Added test for the Exception using string resource Sch_LengthGtBaseLength as its message. This covers a source line and branch not previously covered. This test fails due to the invalid formatters. * Reworded string resource Sch_LengthGtBaseLength to remove the invalid formatters. * Added unit tests for uses of string resource Sch_FacetBaseFixed. * Made test for the message containing "fixed" more specific. * Reworded string resource Sch_FacetBaseFixed to remove the invalid formatter. * Added unit test to cover usage of string resource Sch_InvalidAllMax. A second usage of this string resource is not covered as it is in a class marked Obsolete. * Reworded string resource Sch_InvalidAllMax to remove the invalid formatter. * Added unit test for String Resource Sch_InvalidAllElementMax - invalid formatter. * Reworded string resource Sch_InvalidAllElementMax to remove the invalid formatter. * Added unit test which causes an XmlSchemaException using string resource Sch_InvalidExemplar as its message. * Reworded Sch_InvalidExemplar to remove the invalid formatter. Also, added the name of the element which cannot be used as the substitution group affiliation. * Added unit test that causes an XmlSchemaException to be thrown using string resource Sch_GroupBaseRestNotEmptiable as its message. * Removed the curly braces so there are no longer any invalid formatters. * Added unit tests that cause an XmlSchemaException to be thrown using string resource Sch_AllRefMinMax as its message. * Changed string resource Sch_AllRefMinMax to remove the invalid formatters. * reworded Sch_MinLengthGtBaseMinLength and Sch_MaxLengthGtBaseMaxLength similarly to Sch_LengthGtBaseLength * Corrected error "greater than" to "less than". * Changed name of test to more accurately reflect its purpose. * Changed casing of MinLength and MaxLength to match their XML facets. Removed redundant ToLower call and comment. * Removed all Regex used to find invalid formatters. * renamed MaxMinLengthBaseLength_TestData to indicate that this is testing the successful case. * Removed suppression of exception so that we will see the exception if one is thrown. * Removed comments as there are issues tracking these. * Fixed comment larger -> lower. * Removed XML comments on test methods. * Removal of XML comment that was missed.
i.e. https://github.com/dotnet/corefx/blob/master/src/System.Private.Xml/src/Resources/Strings.resx#L1722
{facets}
instead of i.e.{0}
. This is likely causing some random exceptions to some peopleThe text was updated successfully, but these errors were encountered: