Skip to content

[release/11.0.1xx-preview2] Fix empty string binding to nullable value types#34245

Closed
github-actions[bot] wants to merge 3 commits intorelease/11.0.1xx-preview2from
backport/pr-33536-to-release/11.0.1xx-preview2
Closed

[release/11.0.1xx-preview2] Fix empty string binding to nullable value types#34245
github-actions[bot] wants to merge 3 commits intorelease/11.0.1xx-preview2from
backport/pr-33536-to-release/11.0.1xx-preview2

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Backport of #33536 to release/11.0.1xx-preview2

/cc @StephaneDelcroix

When binding Entry.Text to a nullable value type (e.g., int?), clearing
the Entry now correctly sets the property to null instead of retaining
the previous value.

Fixes #8342
- Use string.IsNullOrEmpty instead of IsNullOrWhiteSpace so whitespace
  strings fail conversion rather than silently becoming null
- Add 'value is string' guard to prevent non-string values from being
  incorrectly converted to null via the string.Empty fallback
- Add tests for whitespace retention, double? nullable type, and
  re-entering a value after clearing
…tation

The original fix that converted all null values to empty string for string
targets broke existing tests that expect null to remain null.

Reverted that change. The test now expects Entry.Text to be null (not "")
after the nullable int becomes null, which is correct - Entry displays
empty for both null and "" text values.
@PureWeen
Copy link
Copy Markdown
Member

#34260

@PureWeen PureWeen closed this Feb 27, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants