3.1.11: Add missing Ordinal to parameter StartsWith comparison #23052
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Original PR merged for 5.0: #18873
This backports the fix for #18831 to 3.1.
Description
A missing StringComparison.Ordinal causes a string comparison to be culture-sensitive, and incorrectly omits the @ placeholder character for parameter names when using the Thai culture.
Customer Impact
EF Core 3.1 is largely unusable when using the Thai culture, without a specific non-trivial workaround (replace the ISqlGenerationHelper service).
How found
Reported three times: #18831, #23032, npgsql/efcore.pg#1508
Test coverage
#22625 added the new code analysis support coming with Roslyn for 5.0, including checks for StringComparison. Using the overload without StringComparison now generates a compilation error.
Regression?
Not within 3.1.x.
Risk
Extremely low - the change adds a missing StringComparison.Ordinal in a single call site.