Repository navigation
Conversation
The CSS `transform` property handler in VisualElement parsed numbers with double.TryParse(string, out double), which uses the current culture. On devices set to a culture that uses a comma as the decimal separator, such as de-DE, `scale(1.5,1.5)` produced a scale of 15 and `translate(10.5,20.25)` produced 105 and 2025. In fr-FR, values such as `rotate(45.5)` failed to parse and threw a FormatException. CSS numbers always use a period as the decimal separator, so parse them with CultureInfo.InvariantCulture, as the other CSS and XAML type converters already do.
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39715Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39715" |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Hey there @@johnkaram02! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Hey there @johnkaram02! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| } | ||
|
|
||
| static bool TryParseTransformValue(string value, out double result) | ||
| => double.TryParse(value, NumberStyles.Number, CultureInfo.InvariantCulture, out result); |
There was a problem hiding this comment.
[major] Logic and Correctness Verification - Preserve exponent notation when switching to invariant culture. The previous double.TryParse overload allowed exponents, but NumberStyles.Number does not. Under en-US, transform: rotate(1e2); previously set Rotation to 100 and now throws FormatException during style application; scale(1e-1,1e-1) silently leaves the scales unchanged instead of setting them to 0.1. CssReader and Style.Parse pass these values through unchanged. Retain AllowExponent (for example, NumberStyles.Float | NumberStyles.AllowThousands) and add exponent-form cases alongside the new decimal/culture tests.
There was a problem hiding this comment.
Fixed in 1d0bf7e. TryParseTransformValue now uses NumberStyles.Float | NumberStyles.AllowThousands, the styles that double.TryParse(string, out double) used before, with the invariant culture. TransformValuesAcceptExponentNotation applies rotate(1e2) scale(1e-1,2.5e-1) under en-US and de-DE. On the previous commit it fails with FormatException: Invalid transform name. With the change, all 16 StyleTests pass on net10.0.
This comment has been minimized.
This comment has been minimized.
NumberStyles.Number rejects exponents, so rotate(1e2) threw a FormatException. Use NumberStyles.Float | NumberStyles.AllowThousands, which double.TryParse used before the invariant culture change.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Expert Review — 0 findings
Reviewed commit 1d0bf7e.
PR Test Gate
🧪 Gate analysis — click to expand✅ Passed. The selected verification satisfied the gate's passing conditions. Unmatched, skipped, or inconclusive groups are not passing evidence. 🧪 Unit tests
Execution log excerptsWithout fix With fix PR head: 1d0bf7e8. Without-fix baseline: e10376bc. |
This comment has been minimized.
This comment has been minimized.
Tests Failure Analysis
🧪 CI Analysis — click to expand📊 maui-prNo failures found. 🧪 maui-pr-devicetests
🧪 maui-pr-uitests
Five target samples are partial; missing matches cannot establish passes. 🧭 Follow-up — actions and refreshNext action: Compare matched runtimes; inspect crash dump and visual diffs.
|
Preserve single-value translate and scale support while routing all values through invariant-culture parsing. Retain both regression suites and exercise fractional single-value transforms across cultures. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Resolved both conflicts against the PR's current target,
Validation: 88 stylesheet tests passed, zero failures or skips with: env -u GH_TOKEN -u GITHUB_TOKEN -u COPILOT_GITHUB_TOKEN .dotnet/dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --filter 'FullyQualifiedName~StyleSheets' -p:_MauiDesignDllBuild=false -p:IncludeAndroidTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false --verbosity quiet
|
<!-- 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 of Change The CSS `transform` property handler, `VisualElement.OnTransformChanged`, parsed its numbers with `double.TryParse(string, out double)`, which uses the current culture. CSS numbers always use a period as the decimal separator, so on cultures such as de-DE `scale(1.5,1.5)` produced a scale of 15, and on fr-FR `rotate(45.5)` threw `FormatException`. This change parses all transform values with `NumberStyles.Number` and `CultureInfo.InvariantCulture`, which matches the other CSS and XAML type converters. Tests: adds `TransformValuesUseInvariantCulture` and `SingleAxisTransformValuesUseInvariantCulture` to `StyleSheets/StyleTests.cs`. They run under en-US, de-DE and fr-FR. They fail without the change and pass with it. I ran `Controls.Core.UnitTests` on Linux (net10.0): 5870 passed, 30 skipped, 0 failed. I did not test on a device. ### Issues Fixed Fixes #<issue number> --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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 of Change The CSS `transform` property handler, `VisualElement.OnTransformChanged`, parsed its numbers with `double.TryParse(string, out double)`, which uses the current culture. CSS numbers always use a period as the decimal separator, so on cultures such as de-DE `scale(1.5,1.5)` produced a scale of 15, and on fr-FR `rotate(45.5)` threw `FormatException`. This change parses all transform values with `NumberStyles.Number` and `CultureInfo.InvariantCulture`, which matches the other CSS and XAML type converters. Tests: adds `TransformValuesUseInvariantCulture` and `SingleAxisTransformValuesUseInvariantCulture` to `StyleSheets/StyleTests.cs`. They run under en-US, de-DE and fr-FR. They fail without the change and pass with it. I ran `Controls.Core.UnitTests` on Linux (net10.0): 5870 passed, 30 skipped, 0 failed. I did not test on a device. ### Issues Fixed Fixes #<issue number> --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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 of Change The CSS `transform` property handler, `VisualElement.OnTransformChanged`, parsed its numbers with `double.TryParse(string, out double)`, which uses the current culture. CSS numbers always use a period as the decimal separator, so on cultures such as de-DE `scale(1.5,1.5)` produced a scale of 15, and on fr-FR `rotate(45.5)` threw `FormatException`. This change parses all transform values with `NumberStyles.Number` and `CultureInfo.InvariantCulture`, which matches the other CSS and XAML type converters. Tests: adds `TransformValuesUseInvariantCulture` and `SingleAxisTransformValuesUseInvariantCulture` to `StyleSheets/StyleTests.cs`. They run under en-US, de-DE and fr-FR. They fail without the change and pass with it. I ran `Controls.Core.UnitTests` on Linux (net10.0): 5870 passed, 30 skipped, 0 failed. I did not test on a device. ### Issues Fixed Fixes #<issue number> --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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 of Change The CSS `transform` property handler, `VisualElement.OnTransformChanged`, parsed its numbers with `double.TryParse(string, out double)`, which uses the current culture. CSS numbers always use a period as the decimal separator, so on cultures such as de-DE `scale(1.5,1.5)` produced a scale of 15, and on fr-FR `rotate(45.5)` threw `FormatException`. This change parses all transform values with `NumberStyles.Number` and `CultureInfo.InvariantCulture`, which matches the other CSS and XAML type converters. Tests: adds `TransformValuesUseInvariantCulture` and `SingleAxisTransformValuesUseInvariantCulture` to `StyleSheets/StyleTests.cs`. They run under en-US, de-DE and fr-FR. They fail without the change and pass with it. I ran `Controls.Core.UnitTests` on Linux (net10.0): 5870 passed, 30 skipped, 0 failed. I did not test on a device. ### Issues Fixed Fixes #<issue number> --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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 of Change The CSS `transform` property handler, `VisualElement.OnTransformChanged`, parsed its numbers with `double.TryParse(string, out double)`, which uses the current culture. CSS numbers always use a period as the decimal separator, so on cultures such as de-DE `scale(1.5,1.5)` produced a scale of 15, and on fr-FR `rotate(45.5)` threw `FormatException`. This change parses all transform values with `NumberStyles.Number` and `CultureInfo.InvariantCulture`, which matches the other CSS and XAML type converters. Tests: adds `TransformValuesUseInvariantCulture` and `SingleAxisTransformValuesUseInvariantCulture` to `StyleSheets/StyleTests.cs`. They run under en-US, de-DE and fr-FR. They fail without the change and pass with it. I ran `Controls.Core.UnitTests` on Linux (net10.0): 5870 passed, 30 skipped, 0 failed. I did not test on a device. ### Issues Fixed Fixes #<issue number> --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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 of Change The CSS `transform` property handler, `VisualElement.OnTransformChanged`, parsed its numbers with `double.TryParse(string, out double)`, which uses the current culture. CSS numbers always use a period as the decimal separator, so on cultures such as de-DE `scale(1.5,1.5)` produced a scale of 15, and on fr-FR `rotate(45.5)` threw `FormatException`. This change parses all transform values with `NumberStyles.Number` and `CultureInfo.InvariantCulture`, which matches the other CSS and XAML type converters. Tests: adds `TransformValuesUseInvariantCulture` and `SingleAxisTransformValuesUseInvariantCulture` to `StyleSheets/StyleTests.cs`. They run under en-US, de-DE and fr-FR. They fail without the change and pass with it. I ran `Controls.Core.UnitTests` on Linux (net10.0): 5870 passed, 30 skipped, 0 failed. I did not test on a device. ### Issues Fixed Fixes #<issue number> --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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 of Change The CSS `transform` property handler, `VisualElement.OnTransformChanged`, parsed its numbers with `double.TryParse(string, out double)`, which uses the current culture. CSS numbers always use a period as the decimal separator, so on cultures such as de-DE `scale(1.5,1.5)` produced a scale of 15, and on fr-FR `rotate(45.5)` threw `FormatException`. This change parses all transform values with `NumberStyles.Number` and `CultureInfo.InvariantCulture`, which matches the other CSS and XAML type converters. Tests: adds `TransformValuesUseInvariantCulture` and `SingleAxisTransformValuesUseInvariantCulture` to `StyleSheets/StyleTests.cs`. They run under en-US, de-DE and fr-FR. They fail without the change and pass with it. I ran `Controls.Core.UnitTests` on Linux (net10.0): 5870 passed, 30 skipped, 0 failed. I did not test on a device. ### Issues Fixed Fixes #<issue number> --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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 of Change The CSS `transform` property handler, `VisualElement.OnTransformChanged`, parsed its numbers with `double.TryParse(string, out double)`, which uses the current culture. CSS numbers always use a period as the decimal separator, so on cultures such as de-DE `scale(1.5,1.5)` produced a scale of 15, and on fr-FR `rotate(45.5)` threw `FormatException`. This change parses all transform values with `NumberStyles.Number` and `CultureInfo.InvariantCulture`, which matches the other CSS and XAML type converters. Tests: adds `TransformValuesUseInvariantCulture` and `SingleAxisTransformValuesUseInvariantCulture` to `StyleSheets/StyleTests.cs`. They run under en-US, de-DE and fr-FR. They fail without the change and pass with it. I ran `Controls.Core.UnitTests` on Linux (net10.0): 5870 passed, 30 skipped, 0 failed. I did not test on a device. ### Issues Fixed Fixes #<issue number> --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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 of Change The CSS `transform` property handler, `VisualElement.OnTransformChanged`, parsed its numbers with `double.TryParse(string, out double)`, which uses the current culture. CSS numbers always use a period as the decimal separator, so on cultures such as de-DE `scale(1.5,1.5)` produced a scale of 15, and on fr-FR `rotate(45.5)` threw `FormatException`. This change parses all transform values with `NumberStyles.Number` and `CultureInfo.InvariantCulture`, which matches the other CSS and XAML type converters. Tests: adds `TransformValuesUseInvariantCulture` and `SingleAxisTransformValuesUseInvariantCulture` to `StyleSheets/StyleTests.cs`. They run under en-US, de-DE and fr-FR. They fail without the change and pass with it. I ran `Controls.Core.UnitTests` on Linux (net10.0): 5870 passed, 30 skipped, 0 failed. I did not test on a device. ### Issues Fixed Fixes #<issue number> --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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 of Change The CSS `transform` property handler, `VisualElement.OnTransformChanged`, parsed its numbers with `double.TryParse(string, out double)`, which uses the current culture. CSS numbers always use a period as the decimal separator, so on cultures such as de-DE `scale(1.5,1.5)` produced a scale of 15, and on fr-FR `rotate(45.5)` threw `FormatException`. This change parses all transform values with `NumberStyles.Number` and `CultureInfo.InvariantCulture`, which matches the other CSS and XAML type converters. Tests: adds `TransformValuesUseInvariantCulture` and `SingleAxisTransformValuesUseInvariantCulture` to `StyleSheets/StyleTests.cs`. They run under en-US, de-DE and fr-FR. They fail without the change and pass with it. I ran `Controls.Core.UnitTests` on Linux (net10.0): 5870 passed, 30 skipped, 0 failed. I did not test on a device. ### Issues Fixed Fixes #<issue number> --------- Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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 of Change
The CSS
transformproperty handler,VisualElement.OnTransformChanged, parsed its numbers withdouble.TryParse(string, out double), which uses the current culture. CSS numbers always use a period as the decimal separator, so on cultures such as de-DEscale(1.5,1.5)produced a scale of 15, and on fr-FRrotate(45.5)threwFormatException.This change parses all transform values with
NumberStyles.NumberandCultureInfo.InvariantCulture, which matches the other CSS and XAML type converters.Tests: adds
TransformValuesUseInvariantCultureandSingleAxisTransformValuesUseInvariantCulturetoStyleSheets/StyleTests.cs. They run under en-US, de-DE and fr-FR. They fail without the change and pass with it. I ranControls.Core.UnitTestson Linux (net10.0): 5870 passed, 30 skipped, 0 failed. I did not test on a device.Issues Fixed
Fixes #