Skip to content

Claude/fix issue 892 char empty comparison#1256

Draft
GrahamTheCoder wants to merge 5 commits intoicsharpcode:masterfrom
GrahamTheCoder:claude/fix-issue-892-char-empty-comparison
Draft

Claude/fix issue 892 char empty comparison#1256
GrahamTheCoder wants to merge 5 commits intoicsharpcode:masterfrom
GrahamTheCoder:claude/fix-issue-892-char-empty-comparison

Conversation

@GrahamTheCoder
Copy link
Copy Markdown
Member

Fixes #892

((lhsTypeInfo.Type?.SpecialType == SpecialType.System_Char && rhsTypeInfo.Type?.SpecialType == SpecialType.System_String && _visualBasicEqualityComparison.IsNothingOrEmpty(node.Right)) ||
(rhsTypeInfo.Type?.SpecialType == SpecialType.System_Char && lhsTypeInfo.Type?.SpecialType == SpecialType.System_String && _visualBasicEqualityComparison.IsNothingOrEmpty(node.Left)))) {
if (lhsTypeInfo.Type?.SpecialType == SpecialType.System_Char) {
rhs = CS.SyntaxFactory.MemberAccessExpression(CS.SyntaxKind.SimpleMemberAccessExpression, CS.SyntaxFactory.PredefinedType(CS.SyntaxFactory.Token(CS.SyntaxKind.CharKeyword)), CS.SyntaxFactory.IdentifierName("MinValue"));
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Look like a hack to make the specific test case work rather than the general fix to the root cause

@GrahamTheCoder GrahamTheCoder marked this pull request as draft April 13, 2026 22:48
GrahamTheCoder and others added 5 commits April 16, 2026 23:23
Map VB.NET char comparison with an empty string to char.MinValue to match runtime behavior and prevent logic errors during compilation. Added a unit test.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Map VB.NET char comparison with an empty string to char.MinValue to match runtime behavior and prevent logic errors during compilation.
For `Option Compare Text`, map it appropriately using `Microsoft.VisualBasic.CompilerServices.Conversions.ToString` to prevent `char` being compared to an empty string.
Added characterization tests.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
…omparison fix

Remove leftover patch artifacts (.orig, .rej, patch file) and temporary TestDotNet
debugging files that were committed by mistake. Expand the regression test to also
cover the not-equal (<>) operator case.

https://claude.ai/code/session_01AkwUvu3XuCdj3D4axoX4UX
…Check

Move the root cause fix (char vs empty string comparison) from
BinaryExpressionConverter into VisualBasicEqualityComparison.TryConvertToNull
OrEmptyCheck, which is the natural home for all null/empty comparison rewrites.
This also correctly handles OptionCompareText (char comparison is never
text-sensitive so it runs before the OptionCompareTextCaseInsensitive bail-out).

https://claude.ai/code/session_01AkwUvu3XuCdj3D4axoX4UX
…indows

The net472+UseWPF Vsix project cannot be evaluated by the .NET 10 SDK
without triggering 'target platform must be set to Windows' errors.

https://claude.ai/code/session_01AkwUvu3XuCdj3D4axoX4UX
@GrahamTheCoder GrahamTheCoder force-pushed the claude/fix-issue-892-char-empty-comparison branch from 0c37d0e to c59702c Compare April 16, 2026 23:23
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.

VB -> C#: wrong result for empty char comparisation

2 participants