Skip to content

Conversation

@LeafShi1
Copy link
Member

@LeafShi1 LeafShi1 commented Nov 25, 2025

Fixes #14072

Proposed changes

  • The original implementation of CharIsPrintable contains a semantic error in the combination of is not and or. As a result, it returns true for any character that is not Control, incorrectly classifying characters from Format, LineSeparator, ParagraphSeparator, and OtherNotAssigned as printable.
    Impact: Zero-width spaces, line separators, paragraph separators, and unassigned code points are treated as printable, even though they render as invisible, garbled symbols, or empty spaces.
Microsoft Reviewers: Open in CodeFlow

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical logic error in the CharIsPrintable method where operator precedence caused incorrect Unicode character classification. The bug resulted in characters from categories like Format, LineSeparator, ParagraphSeparator, and OtherNotAssigned being incorrectly classified as printable.

Key Changes

  • Fixed operator precedence by adding parentheses around the or pattern combination in the CharIsPrintable method

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.15293%. Comparing base (b33edbc) to head (7c8973a).

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #14079         +/-   ##
===================================================
- Coverage   77.15510%   77.15293%   -0.00218%     
===================================================
  Files           3279        3279                 
  Lines         645317      645317                 
  Branches       47718       47719          +1     
===================================================
- Hits          497895      497881         -14     
- Misses        143733      143744         +11     
- Partials        3689        3692          +3     
Flag Coverage Δ
Debug 77.15293% <100.00000%> (-0.00218%) ⬇️
integration 18.98651% <0.00000%> (-0.00767%) ⬇️
production 52.01413% <100.00000%> (-0.00487%) ⬇️
test 97.40749% <ø> (ø)
unit 49.46430% <100.00000%> (+0.00486%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible incorrect use of "NOT ... OR ..." pattern

1 participant