Skip to content

Fix Issue #1089: Don't optimize Option Compare Text empty string#1232

Merged
GrahamTheCoder merged 1 commit intomasterfrom
fix-issue-1089-16460915266695110559
Mar 14, 2026
Merged

Fix Issue #1089: Don't optimize Option Compare Text empty string#1232
GrahamTheCoder merged 1 commit intomasterfrom
fix-issue-1089-16460915266695110559

Conversation

@GrahamTheCoder
Copy link
Member

Fix Issue #1089: Don't optimize Option Compare Text empty string checks to string.IsNullOrEmpty()

Under Option Compare Text, Visual Basic evaluates certain invisible character strings as equal to "". Optimizing this down to string.IsNullOrEmpty in C# breaks correct behavior because C# considers these strings non-empty. This commit skips the null/empty optimization when OptionCompareTextCaseInsensitive is true, causing it to fall back to CultureInfo.CurrentCulture.CompareInfo.Compare logic.

…ks to string.IsNullOrEmpty()

Under Option Compare Text, Visual Basic evaluates certain invisible character strings as equal to `""`. Optimizing this down to `string.IsNullOrEmpty` in C# breaks correct behavior because C# considers these strings non-empty. This commit skips the null/empty optimization when `OptionCompareTextCaseInsensitive` is true, causing it to fall back to `CultureInfo.CurrentCulture.CompareInfo.Compare` logic.

Co-authored-by: GrahamTheCoder <2490482+GrahamTheCoder@users.noreply.github.com>
@GrahamTheCoder GrahamTheCoder merged commit e8000f7 into master Mar 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant