Skip to content

fix: refuse a char compared with a number no char has - #173

Merged
CaffeinatedCoder merged 1 commit into
mainfrom
fix/168-char-code
Nov 17, 2026
Merged

CaffeinatedCoder merged 1 commit into
mainfrom
fix/168-char-code

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #168

Problem

LambdaTranslator.CharCode turned the number a char column is compared with back into a char with (char)code, unchecked. A number no char has wrapped round to another one: x => x.Grade == 65601, which C# never holds, was stored as {Grade} = 'A'; x.Grade > -1, which it always holds, as a comparison with U+FFFF. In a where: the constraint held over other rows than the model declared, and nothing reported it. Found by the pre-tag review; it came with the 5.x port.

Change

  • CharCode refuses a code outside char.MinValue..char.MaxValue with NotSupportedException where the lambda is written (SchemaKitStrings.NotACharacter), on either side of the comparison, written or captured. A number some char has is still written as that char (x.Grade == 65 → {Grade} = 'A').
  • ParityCatalogue says why char-against-number rows stay out of the sweep and where they are held.

Tests

  • LambdaTranslatorTests.A_char_compared_with_a_number_no_char_has_is_refused: five rows (==, <, >, operand on the left, a captured value). With LambdaTranslator.cs reverted it fails: "Expected exception of exact type NotSupportedException but no exception was thrown."
  • A_char_is_compared_as_the_char_it_was_written_as gains x.Grade == 65.
  • Kernel offline suite: 726 passed.

silent into 11.0.0-preview.1: minor 0, so no ### Changed answers row; the version is unreleased.

🤖 Generated with Claude Code

x.Grade == 65601 was stored as {Grade} = 'A': the number wrapped round to another
char, and a comparison C# answers alike for every row held for some rows only.
CharCode now refuses a code outside char's range where the lambda is written.

Closes #168

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder added this to the 11.0.0 milestone Nov 17, 2026
@CaffeinatedCoder CaffeinatedCoder added bug Something isn't working silent Answers wrongly without throwing; the fix ships as a minor, never a patch package/core Affects CodoMetis.EFCore.SchemaKit (the kernel) severity/medium Inconsistency or failure in a narrow scenario area/expression-indexes Expression, typed lambda and JSON member indexes labels Nov 17, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit 2f3abb0 into main Nov 17, 2026
11 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the fix/168-char-code branch November 17, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/expression-indexes Expression, typed lambda and JSON member indexes bug Something isn't working package/core Affects CodoMetis.EFCore.SchemaKit (the kernel) severity/medium Inconsistency or failure in a narrow scenario silent Answers wrongly without throwing; the fix ships as a minor, never a patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A char column compared with a number outside 0..65535 is stored as a comparison with another character

1 participant