[XSG] Fix NaN value in XAML generating invalid code#33533
Merged
PureWeen merged 1 commit intoinflight/currentfrom Jan 16, 2026
Merged
[XSG] Fix NaN value in XAML generating invalid code#33533PureWeen merged 1 commit intoinflight/currentfrom
PureWeen merged 1 commit intoinflight/currentfrom
Conversation
Fixes #33532 When XAML contains NaN as a value (e.g., Padding="NaN"), the XAML Source Generator was generating invalid C# code using bare "NaN" instead of "double.NaN", causing CS0103 compiler error. The root cause was that SymbolDisplay.FormatPrimitive() outputs just "NaN" without the type prefix. Updated FormatInvariant() in GeneratorHelpers.cs to explicitly handle special floating-point values (NaN, PositiveInfinity, NegativeInfinity) for both double and float types. Added tests: - SourceGen.UnitTests/Maui33532Tests.cs (5 tests for ThicknessConverter) - Xaml.UnitTests/Issues/Maui33532.xaml[.cs] (XAML inflator tests)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #33532 where NaN values in XAML properties (e.g., Padding="NaN") generated invalid C# code. The XAML Source Generator was outputting bare NaN instead of the properly qualified double.NaN, causing compilation errors.
Changes:
- Updated
FormatInvariant()helper method to explicitly handle special floating-point values (NaN, PositiveInfinity, NegativeInfinity) for both double and float types - Added 5 SourceGen unit tests covering various NaN scenarios with ThicknessConverter
- Added XAML unit test to verify NaN values work across all inflators (Runtime, XamlC, SourceGen)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Controls/src/SourceGen/GeneratorHelpers.cs | Added early-return checks for special floating-point values before calling SymbolDisplay.FormatPrimitive |
| src/Controls/tests/SourceGen.UnitTests/Maui33532Tests.cs | Comprehensive test suite validating generated code contains "double.NaN" for single, dual, and quad NaN values, plus mixed scenarios |
| src/Controls/tests/Xaml.UnitTests/Issues/Maui33532.xaml | XAML test file with three Button elements testing different NaN syntaxes in Padding attribute |
| src/Controls/tests/Xaml.UnitTests/Issues/Maui33532.xaml.cs | Test verifying NaN values are applied correctly across all inflators, with one incomplete assertion |
simonrozsival
approved these changes
Jan 16, 2026
mattleibow
approved these changes
Jan 16, 2026
github-actions bot
pushed a commit
that referenced
this pull request
Jan 20, 2026
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Fixes #33532 When a XAML file contains `NaN` as a value (e.g., `Padding="NaN"`), the XAML Source Generator was generating invalid C# code using bare `NaN` instead of `double.NaN`, resulting in: ``` error CS0103: The name 'NaN' does not exist in the current context ``` ### Root Cause The `FormatInvariant()` helper method in `GeneratorHelpers.cs` uses `SymbolDisplay.FormatPrimitive()` which outputs just `"NaN"` for `double.NaN` values, without the required type prefix. ### Fix Updated `FormatInvariant()` to explicitly check for special floating-point values (`NaN`, `PositiveInfinity`, `NegativeInfinity`) for both `double` and `float` types, and return the properly qualified C# literals (e.g., `double.NaN`, `float.PositiveInfinity`). ## Changes ### Modified - `src/Controls/src/SourceGen/GeneratorHelpers.cs` - Added special handling for NaN and Infinity values ### Added Tests - `src/Controls/tests/SourceGen.UnitTests/Maui33532Tests.cs` - 5 SourceGen unit tests for ThicknessConverter with NaN - `src/Controls/tests/Xaml.UnitTests/Issues/Maui33532.xaml[.cs]` - XAML unit test for all inflators ## Testing All new tests pass: - `ThicknessWithSingleNaNValue` - Tests `Padding="NaN"` - `ThicknessWithTwoNaNValues` - Tests `Padding="NaN,NaN"` - `ThicknessWithFourNaNValues` - Tests `Padding="NaN,NaN,NaN,NaN"` - `ThicknessWithMixedNaNAndRegularValues` - Tests `Padding="NaN,10,NaN,20"` - `MarginWithNaNValue` - Tests `Margin="NaN"`
github-actions bot
pushed a commit
that referenced
this pull request
Jan 21, 2026
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Fixes #33532 When a XAML file contains `NaN` as a value (e.g., `Padding="NaN"`), the XAML Source Generator was generating invalid C# code using bare `NaN` instead of `double.NaN`, resulting in: ``` error CS0103: The name 'NaN' does not exist in the current context ``` ### Root Cause The `FormatInvariant()` helper method in `GeneratorHelpers.cs` uses `SymbolDisplay.FormatPrimitive()` which outputs just `"NaN"` for `double.NaN` values, without the required type prefix. ### Fix Updated `FormatInvariant()` to explicitly check for special floating-point values (`NaN`, `PositiveInfinity`, `NegativeInfinity`) for both `double` and `float` types, and return the properly qualified C# literals (e.g., `double.NaN`, `float.PositiveInfinity`). ## Changes ### Modified - `src/Controls/src/SourceGen/GeneratorHelpers.cs` - Added special handling for NaN and Infinity values ### Added Tests - `src/Controls/tests/SourceGen.UnitTests/Maui33532Tests.cs` - 5 SourceGen unit tests for ThicknessConverter with NaN - `src/Controls/tests/Xaml.UnitTests/Issues/Maui33532.xaml[.cs]` - XAML unit test for all inflators ## Testing All new tests pass: - `ThicknessWithSingleNaNValue` - Tests `Padding="NaN"` - `ThicknessWithTwoNaNValues` - Tests `Padding="NaN,NaN"` - `ThicknessWithFourNaNValues` - Tests `Padding="NaN,NaN,NaN,NaN"` - `ThicknessWithMixedNaNAndRegularValues` - Tests `Padding="NaN,10,NaN,20"` - `MarginWithNaNValue` - Tests `Margin="NaN"`
github-actions bot
pushed a commit
that referenced
this pull request
Jan 23, 2026
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Fixes #33532 When a XAML file contains `NaN` as a value (e.g., `Padding="NaN"`), the XAML Source Generator was generating invalid C# code using bare `NaN` instead of `double.NaN`, resulting in: ``` error CS0103: The name 'NaN' does not exist in the current context ``` ### Root Cause The `FormatInvariant()` helper method in `GeneratorHelpers.cs` uses `SymbolDisplay.FormatPrimitive()` which outputs just `"NaN"` for `double.NaN` values, without the required type prefix. ### Fix Updated `FormatInvariant()` to explicitly check for special floating-point values (`NaN`, `PositiveInfinity`, `NegativeInfinity`) for both `double` and `float` types, and return the properly qualified C# literals (e.g., `double.NaN`, `float.PositiveInfinity`). ## Changes ### Modified - `src/Controls/src/SourceGen/GeneratorHelpers.cs` - Added special handling for NaN and Infinity values ### Added Tests - `src/Controls/tests/SourceGen.UnitTests/Maui33532Tests.cs` - 5 SourceGen unit tests for ThicknessConverter with NaN - `src/Controls/tests/Xaml.UnitTests/Issues/Maui33532.xaml[.cs]` - XAML unit test for all inflators ## Testing All new tests pass: - `ThicknessWithSingleNaNValue` - Tests `Padding="NaN"` - `ThicknessWithTwoNaNValues` - Tests `Padding="NaN,NaN"` - `ThicknessWithFourNaNValues` - Tests `Padding="NaN,NaN,NaN,NaN"` - `ThicknessWithMixedNaNAndRegularValues` - Tests `Padding="NaN,10,NaN,20"` - `MarginWithNaNValue` - Tests `Margin="NaN"`
PureWeen
pushed a commit
that referenced
this pull request
Jan 27, 2026
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Fixes #33532 When a XAML file contains `NaN` as a value (e.g., `Padding="NaN"`), the XAML Source Generator was generating invalid C# code using bare `NaN` instead of `double.NaN`, resulting in: ``` error CS0103: The name 'NaN' does not exist in the current context ``` ### Root Cause The `FormatInvariant()` helper method in `GeneratorHelpers.cs` uses `SymbolDisplay.FormatPrimitive()` which outputs just `"NaN"` for `double.NaN` values, without the required type prefix. ### Fix Updated `FormatInvariant()` to explicitly check for special floating-point values (`NaN`, `PositiveInfinity`, `NegativeInfinity`) for both `double` and `float` types, and return the properly qualified C# literals (e.g., `double.NaN`, `float.PositiveInfinity`). ## Changes ### Modified - `src/Controls/src/SourceGen/GeneratorHelpers.cs` - Added special handling for NaN and Infinity values ### Added Tests - `src/Controls/tests/SourceGen.UnitTests/Maui33532Tests.cs` - 5 SourceGen unit tests for ThicknessConverter with NaN - `src/Controls/tests/Xaml.UnitTests/Issues/Maui33532.xaml[.cs]` - XAML unit test for all inflators ## Testing All new tests pass: - `ThicknessWithSingleNaNValue` - Tests `Padding="NaN"` - `ThicknessWithTwoNaNValues` - Tests `Padding="NaN,NaN"` - `ThicknessWithFourNaNValues` - Tests `Padding="NaN,NaN,NaN,NaN"` - `ThicknessWithMixedNaNAndRegularValues` - Tests `Padding="NaN,10,NaN,20"` - `MarginWithNaNValue` - Tests `Margin="NaN"`
PureWeen
pushed a commit
that referenced
this pull request
Jan 29, 2026
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Fixes #33532 When a XAML file contains `NaN` as a value (e.g., `Padding="NaN"`), the XAML Source Generator was generating invalid C# code using bare `NaN` instead of `double.NaN`, resulting in: ``` error CS0103: The name 'NaN' does not exist in the current context ``` ### Root Cause The `FormatInvariant()` helper method in `GeneratorHelpers.cs` uses `SymbolDisplay.FormatPrimitive()` which outputs just `"NaN"` for `double.NaN` values, without the required type prefix. ### Fix Updated `FormatInvariant()` to explicitly check for special floating-point values (`NaN`, `PositiveInfinity`, `NegativeInfinity`) for both `double` and `float` types, and return the properly qualified C# literals (e.g., `double.NaN`, `float.PositiveInfinity`). ## Changes ### Modified - `src/Controls/src/SourceGen/GeneratorHelpers.cs` - Added special handling for NaN and Infinity values ### Added Tests - `src/Controls/tests/SourceGen.UnitTests/Maui33532Tests.cs` - 5 SourceGen unit tests for ThicknessConverter with NaN - `src/Controls/tests/Xaml.UnitTests/Issues/Maui33532.xaml[.cs]` - XAML unit test for all inflators ## Testing All new tests pass: - `ThicknessWithSingleNaNValue` - Tests `Padding="NaN"` - `ThicknessWithTwoNaNValues` - Tests `Padding="NaN,NaN"` - `ThicknessWithFourNaNValues` - Tests `Padding="NaN,NaN,NaN,NaN"` - `ThicknessWithMixedNaNAndRegularValues` - Tests `Padding="NaN,10,NaN,20"` - `MarginWithNaNValue` - Tests `Margin="NaN"`
HarishKumarSF4517
added a commit
to HarishKumarSF4517/maui
that referenced
this pull request
Feb 2, 2026
HarishKumarSF4517
added a commit
to HarishKumarSF4517/maui
that referenced
this pull request
Feb 2, 2026
PureWeen
pushed a commit
that referenced
this pull request
Feb 2, 2026
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Fixes #33532 When a XAML file contains `NaN` as a value (e.g., `Padding="NaN"`), the XAML Source Generator was generating invalid C# code using bare `NaN` instead of `double.NaN`, resulting in: ``` error CS0103: The name 'NaN' does not exist in the current context ``` ### Root Cause The `FormatInvariant()` helper method in `GeneratorHelpers.cs` uses `SymbolDisplay.FormatPrimitive()` which outputs just `"NaN"` for `double.NaN` values, without the required type prefix. ### Fix Updated `FormatInvariant()` to explicitly check for special floating-point values (`NaN`, `PositiveInfinity`, `NegativeInfinity`) for both `double` and `float` types, and return the properly qualified C# literals (e.g., `double.NaN`, `float.PositiveInfinity`). ## Changes ### Modified - `src/Controls/src/SourceGen/GeneratorHelpers.cs` - Added special handling for NaN and Infinity values ### Added Tests - `src/Controls/tests/SourceGen.UnitTests/Maui33532Tests.cs` - 5 SourceGen unit tests for ThicknessConverter with NaN - `src/Controls/tests/Xaml.UnitTests/Issues/Maui33532.xaml[.cs]` - XAML unit test for all inflators ## Testing All new tests pass: - `ThicknessWithSingleNaNValue` - Tests `Padding="NaN"` - `ThicknessWithTwoNaNValues` - Tests `Padding="NaN,NaN"` - `ThicknessWithFourNaNValues` - Tests `Padding="NaN,NaN,NaN,NaN"` - `ThicknessWithMixedNaNAndRegularValues` - Tests `Padding="NaN,10,NaN,20"` - `MarginWithNaNValue` - Tests `Margin="NaN"`
github-actions bot
pushed a commit
that referenced
this pull request
Feb 4, 2026
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Fixes #33532 When a XAML file contains `NaN` as a value (e.g., `Padding="NaN"`), the XAML Source Generator was generating invalid C# code using bare `NaN` instead of `double.NaN`, resulting in: ``` error CS0103: The name 'NaN' does not exist in the current context ``` ### Root Cause The `FormatInvariant()` helper method in `GeneratorHelpers.cs` uses `SymbolDisplay.FormatPrimitive()` which outputs just `"NaN"` for `double.NaN` values, without the required type prefix. ### Fix Updated `FormatInvariant()` to explicitly check for special floating-point values (`NaN`, `PositiveInfinity`, `NegativeInfinity`) for both `double` and `float` types, and return the properly qualified C# literals (e.g., `double.NaN`, `float.PositiveInfinity`). ## Changes ### Modified - `src/Controls/src/SourceGen/GeneratorHelpers.cs` - Added special handling for NaN and Infinity values ### Added Tests - `src/Controls/tests/SourceGen.UnitTests/Maui33532Tests.cs` - 5 SourceGen unit tests for ThicknessConverter with NaN - `src/Controls/tests/Xaml.UnitTests/Issues/Maui33532.xaml[.cs]` - XAML unit test for all inflators ## Testing All new tests pass: - `ThicknessWithSingleNaNValue` - Tests `Padding="NaN"` - `ThicknessWithTwoNaNValues` - Tests `Padding="NaN,NaN"` - `ThicknessWithFourNaNValues` - Tests `Padding="NaN,NaN,NaN,NaN"` - `ThicknessWithMixedNaNAndRegularValues` - Tests `Padding="NaN,10,NaN,20"` - `MarginWithNaNValue` - Tests `Margin="NaN"`
github-actions bot
pushed a commit
that referenced
this pull request
Feb 8, 2026
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Fixes #33532 When a XAML file contains `NaN` as a value (e.g., `Padding="NaN"`), the XAML Source Generator was generating invalid C# code using bare `NaN` instead of `double.NaN`, resulting in: ``` error CS0103: The name 'NaN' does not exist in the current context ``` ### Root Cause The `FormatInvariant()` helper method in `GeneratorHelpers.cs` uses `SymbolDisplay.FormatPrimitive()` which outputs just `"NaN"` for `double.NaN` values, without the required type prefix. ### Fix Updated `FormatInvariant()` to explicitly check for special floating-point values (`NaN`, `PositiveInfinity`, `NegativeInfinity`) for both `double` and `float` types, and return the properly qualified C# literals (e.g., `double.NaN`, `float.PositiveInfinity`). ## Changes ### Modified - `src/Controls/src/SourceGen/GeneratorHelpers.cs` - Added special handling for NaN and Infinity values ### Added Tests - `src/Controls/tests/SourceGen.UnitTests/Maui33532Tests.cs` - 5 SourceGen unit tests for ThicknessConverter with NaN - `src/Controls/tests/Xaml.UnitTests/Issues/Maui33532.xaml[.cs]` - XAML unit test for all inflators ## Testing All new tests pass: - `ThicknessWithSingleNaNValue` - Tests `Padding="NaN"` - `ThicknessWithTwoNaNValues` - Tests `Padding="NaN,NaN"` - `ThicknessWithFourNaNValues` - Tests `Padding="NaN,NaN,NaN,NaN"` - `ThicknessWithMixedNaNAndRegularValues` - Tests `Padding="NaN,10,NaN,20"` - `MarginWithNaNValue` - Tests `Margin="NaN"`
PureWeen
pushed a commit
that referenced
this pull request
Feb 9, 2026
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Fixes #33532 When a XAML file contains `NaN` as a value (e.g., `Padding="NaN"`), the XAML Source Generator was generating invalid C# code using bare `NaN` instead of `double.NaN`, resulting in: ``` error CS0103: The name 'NaN' does not exist in the current context ``` ### Root Cause The `FormatInvariant()` helper method in `GeneratorHelpers.cs` uses `SymbolDisplay.FormatPrimitive()` which outputs just `"NaN"` for `double.NaN` values, without the required type prefix. ### Fix Updated `FormatInvariant()` to explicitly check for special floating-point values (`NaN`, `PositiveInfinity`, `NegativeInfinity`) for both `double` and `float` types, and return the properly qualified C# literals (e.g., `double.NaN`, `float.PositiveInfinity`). ## Changes ### Modified - `src/Controls/src/SourceGen/GeneratorHelpers.cs` - Added special handling for NaN and Infinity values ### Added Tests - `src/Controls/tests/SourceGen.UnitTests/Maui33532Tests.cs` - 5 SourceGen unit tests for ThicknessConverter with NaN - `src/Controls/tests/Xaml.UnitTests/Issues/Maui33532.xaml[.cs]` - XAML unit test for all inflators ## Testing All new tests pass: - `ThicknessWithSingleNaNValue` - Tests `Padding="NaN"` - `ThicknessWithTwoNaNValues` - Tests `Padding="NaN,NaN"` - `ThicknessWithFourNaNValues` - Tests `Padding="NaN,NaN,NaN,NaN"` - `ThicknessWithMixedNaNAndRegularValues` - Tests `Padding="NaN,10,NaN,20"` - `MarginWithNaNValue` - Tests `Margin="NaN"`
github-actions bot
pushed a commit
that referenced
this pull request
Feb 9, 2026
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Fixes #33532 When a XAML file contains `NaN` as a value (e.g., `Padding="NaN"`), the XAML Source Generator was generating invalid C# code using bare `NaN` instead of `double.NaN`, resulting in: ``` error CS0103: The name 'NaN' does not exist in the current context ``` ### Root Cause The `FormatInvariant()` helper method in `GeneratorHelpers.cs` uses `SymbolDisplay.FormatPrimitive()` which outputs just `"NaN"` for `double.NaN` values, without the required type prefix. ### Fix Updated `FormatInvariant()` to explicitly check for special floating-point values (`NaN`, `PositiveInfinity`, `NegativeInfinity`) for both `double` and `float` types, and return the properly qualified C# literals (e.g., `double.NaN`, `float.PositiveInfinity`). ## Changes ### Modified - `src/Controls/src/SourceGen/GeneratorHelpers.cs` - Added special handling for NaN and Infinity values ### Added Tests - `src/Controls/tests/SourceGen.UnitTests/Maui33532Tests.cs` - 5 SourceGen unit tests for ThicknessConverter with NaN - `src/Controls/tests/Xaml.UnitTests/Issues/Maui33532.xaml[.cs]` - XAML unit test for all inflators ## Testing All new tests pass: - `ThicknessWithSingleNaNValue` - Tests `Padding="NaN"` - `ThicknessWithTwoNaNValues` - Tests `Padding="NaN,NaN"` - `ThicknessWithFourNaNValues` - Tests `Padding="NaN,NaN,NaN,NaN"` - `ThicknessWithMixedNaNAndRegularValues` - Tests `Padding="NaN,10,NaN,20"` - `MarginWithNaNValue` - Tests `Margin="NaN"`
PureWeen
added a commit
that referenced
this pull request
Feb 10, 2026
.NET MAUI inflight/candidate introduces significant improvements across all platforms with focus on quality, performance, and developer experience. This release includes 20 commits with various improvements, bug fixes, and enhancements. ## Blazor - Fix for BlazorWebView Back Navigation Issues on Android 13+ After Predictive Back Gesture Changes by @SuthiYuvaraj in #33213 <details> <summary>🔧 Fixes</summary> - [Back navigation different between .net 9 and .net 10 blazor hybrid](#32767) </details> ## CollectionView - [Android] Fix for CollectionView.EmptyView does not remeasure its height when the parent layout changes dynamically, causing incorrect sizing. by @BagavathiPerumal in #33559 <details> <summary>🔧 Fixes</summary> - [`CollectionView.EmptyView` does not remeasure its height when the parent layout changes dynamically, causing incorrect sizing.](#33324) </details> - [Android] Fixed CollectionView reordering last item by @vitalii-vov in #17825 <details> <summary>🔧 Fixes</summary> - [Android app crashes when dragging into CollectionView](#17823) </details> ## DateTimePicker - [iOS] Fix VoiceOver focus not shifting to Picker/DatePicker/TimePicker popups by @kubaflo in #33152 <details> <summary>🔧 Fixes</summary> - [Voiceover does not automatically shift focus to the "Category" popup when it opens.: A11y_Developer balance version .NET 10_Project_ScreenReader](#30746) </details> ## Dialogalert - [iOS 26] Fix DisplayPromptAsync maxLength not enforced due to new multi-range delegate by @Shalini-Ashokan in #33616 <details> <summary>🔧 Fixes</summary> - [[iOS 26.1] DisplayPromptAsync ignores maxLength and does not respect RTL FlowDirection](#33549) </details> ## Flyout - [iOS] Shell: Account for SafeArea when positioning flyout footer by @kubaflo in #32891 <details> <summary>🔧 Fixes</summary> - [[IOS] Footer not displaying in iOS when StackOrientation.Horizontal is set on FlyoutFooter](#26395) </details> ## Fonts - Hide obsolete FontSize values from IDE autocomplete by @noiseonwires in #33694 ## Gestures - Android pan fixes by @BurningLights in #21547 <details> <summary>🔧 Fixes</summary> - [Flickering occurs while updating the width of ContentView through PanGestureRecognizer.](#20772) </details> ## Navigation - Shell: Add duplicate route validation for sibling elements by @SubhikshaSf4851 in #32296 <details> <summary>🔧 Fixes</summary> - [OnNavigatedTo is not called when navigating from a specific page](#14000) </details> ## Picker - Improved Unfocus support for Picker on Mac Catalyst by @kubaflo in #33127 <details> <summary>🔧 Fixes</summary> - [When using voiceover unable to access expanded list of project combo box: A11y_.NET maui_user can creat a tak_Screen reader](#30897) - [Task and Project controls are not accessible with keyboard:A11y_.NET maui_User can create a new task_Keyboard](#30891) </details> ## SafeArea - [iOS] SafeArea: Return Empty for non-ISafeAreaView views (opt-in model) by @praveenkumarkarunanithi in #33526 <details> <summary>🔧 Fixes</summary> - [[iOS] SafeArea is not applied when a ContentPage uses a ControlTemplate](#33458) </details> ## Shell - [iOS] Fix ObjectDisposedException in TraitCollectionDidChange on window disposal by @jeremy-visionaid in #33353 <details> <summary>🔧 Fixes</summary> - [Intermittent crash on exit on MacCatalyst - ObjectDisposedException](#33352) </details> - [Issue-Resolver] Explicit fallback for BackButtonBehavior lookup by @kubaflo in #33204 <details> <summary>🔧 Fixes</summary> - [Setting BackButtonBehavior to not visible or not enabled does not work](#28570) - [BackButtonBehavior not bound](#33139) </details> ## Templates - [Templates] Remove redundant SemanticProperties.Description attribute by @kubaflo in #33621 <details> <summary>🔧 Fixes</summary> - [Task and Project controls are not accessible with keyboard:A11y_.NET maui_User can create a new task_Keyboard](#30891) - [Unable to select "Tags" when Voiceover is turned on.: A11y_Developer balance version .NET 10_Project_ScreenReader](#30749) </details> ## Theme - [Windows] Fix runtime theme update for controls and TitleBar by @Tamilarasan-Paranthaman in #31714 <details> <summary>🔧 Fixes</summary> - [[Windows][MacOS?] Change title bar color when switching light/dark theme at runtime](#12507) - [OS system components ignore app theme](#22058) - [[Mac Catalyst][Windows] TitleBar not reacting on UserAppTheme changes](#30518) - [In dark theme "Back" and "hamburger" button icon color contrast with background color is less than 3:1: A11y_.NET maui_User can get all the insights of Dashboard_Non text Contrast](#30807) - [`Switch` is invisible on `PointOver` when theme has changed](#31819) </details> ## Theming - [XSG] Fix Style Setters referencing source-generated bindable properties by @simonrozsival in #33562 ## Titlebar - [Windows] Fix TitleBar.IsVisible = false the caption buttons become unresponsive by @devanathan-vaithiyanathan in #33256 <details> <summary>🔧 Fixes</summary> - [When TitleBar.IsVisible = false the caption buttons become unresponsive on Windows](#33171) </details> ## WebView - Fix WebView JavaScript string escaping for backslashes and quotes by @StephaneDelcroix in #33726 ## Xaml - [XSG] Fix NaN value in XAML generating invalid code by @StephaneDelcroix in #33533 <details> <summary>🔧 Fixes</summary> - [[XSG] NaN value in XAML generates invalid code](#33532) </details> <details> <summary>📦 Other (1)</summary> - Remove InternalsVisibleTo attributes for .NET MAUI Community Toolkit by @jfversluis via @Copilot in #33442 </details> **Full Changelog**: main...inflight/candidate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 #33532
When a XAML file contains
NaNas a value (e.g.,Padding="NaN"), the XAML Source Generator was generating invalid C# code using bareNaNinstead ofdouble.NaN, resulting in:Root Cause
The
FormatInvariant()helper method inGeneratorHelpers.csusesSymbolDisplay.FormatPrimitive()which outputs just"NaN"fordouble.NaNvalues, without the required type prefix.Fix
Updated
FormatInvariant()to explicitly check for special floating-point values (NaN,PositiveInfinity,NegativeInfinity) for bothdoubleandfloattypes, and return the properly qualified C# literals (e.g.,double.NaN,float.PositiveInfinity).Changes
Modified
src/Controls/src/SourceGen/GeneratorHelpers.cs- Added special handling for NaN and Infinity valuesAdded Tests
src/Controls/tests/SourceGen.UnitTests/Maui33532Tests.cs- 5 SourceGen unit tests for ThicknessConverter with NaNsrc/Controls/tests/Xaml.UnitTests/Issues/Maui33532.xaml[.cs]- XAML unit test for all inflatorsTesting
All new tests pass:
ThicknessWithSingleNaNValue- TestsPadding="NaN"ThicknessWithTwoNaNValues- TestsPadding="NaN,NaN"ThicknessWithFourNaNValues- TestsPadding="NaN,NaN,NaN,NaN"ThicknessWithMixedNaNAndRegularValues- TestsPadding="NaN,10,NaN,20"MarginWithNaNValue- TestsMargin="NaN"