Skip to content

Conversation

@StephaneDelcroix
Copy link
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description

Fixes #33871

The XAML Source Generator's ThicknessConverter didn't handle special double values like NaN, Infinity, and -Infinity. This is used by Button.Padding to indicate "use platform default padding" via Padding="NaN".

Changes

  • Add TryParseDouble helper that handles NaN, Infinity, -Infinity in addition to regular numbers
  • Add FormatDouble helper that generates double.NaN, double.PositiveInfinity, double.NegativeInfinity in generated code
  • Add XAML unit test for Padding="NaN"

Testing

  • Added Maui33871.xaml test that verifies Padding="NaN" works with all three inflators (Runtime, XamlC, SourceGen)
  • All 3 test cases pass locally

Fixes #33871

The XAML Source Generator's ThicknessConverter didn't handle special
double values like NaN, Infinity, and -Infinity. This is used by
Button.Padding to indicate 'use platform default padding'.

Changes:
- Add TryParseDouble helper that handles NaN, Infinity, -Infinity
- Add FormatDouble helper that generates double.NaN etc in code
- Add XAML unit test for Padding="NaN"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[XSG] Edge-case type conversions (Padding="NaN") not handled correctly

2 participants