Skip to content

Parse CSS transform values with the invariant culture - #39715

Merged
kubaflo merged 3 commits into
dotnet:candidate/11.0.1xx-sr2from
johnkaram02:fix/css-transform-invariant-culture
Nov 11, 2026
Merged

kubaflo merged 3 commits into
dotnet:candidate/11.0.1xx-sr2from
johnkaram02:fix/css-transform-invariant-culture

Conversation

@johnkaram02

Copy link
Copy Markdown

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 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 #

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.
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39715

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39715"

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Oct 28, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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.

@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Oct 28, 2026
@azure-pipelines

This comment has been minimized.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Expert Review — 1 finding

Reviewed commit b595c69.

See inline comments for details.

}

static bool TryParseTransformValue(string value, out double result)
=> double.TryParse(value, NumberStyles.Number, CultureInfo.InvariantCulture, out result);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

@MauiBot

This comment has been minimized.

@MauiBot MauiBot added s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) and removed s/agent-review-in-progress AI review is currently running for this PR labels Oct 28, 2026
NumberStyles.Number rejects exponents, so rotate(1e2) threw a FormatException. Use NumberStyles.Float | NumberStyles.AllowThousands, which double.TryParse used before the invariant culture change.
@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Oct 29, 2026
@azure-pipelines

This comment has been minimized.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Expert Review — 0 findings

Reviewed commit 1d0bf7e.

@MauiBot

MauiBot commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

PR Test Gate

@johnkaram02 — existing-test verification for commit 1d0bf7e8.

Result PASSED Platform Android Commit 1d0bf7e8


🧪 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
Test group Without fix With fix
StyleTests ✅ Failed as expected (119s) ✅ Passed (90s)
Execution log excerpts

Without fix StyleTests

     at Microsoft.Maui.Controls.StyleSheets.UnitTests.StyleTests.TransformValuesUseInvariantCulture(String culture) in /_/src/Controls/tests/Core.UnitTests/StyleSheets/StyleTests.cs:line 187
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
     at Microsoft.Maui.Controls.VisualElement.OnTransformChanged(BindableObject bindable, Object oldValue, Object newValue) in /_/src/Controls/src/Core/VisualElement/VisualElement.cs:line 264
   at Microsoft.Maui.Controls.BindableObject.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean didChange, Boolean willFirePropertyChanged) in /_/src/Controls/src/Core/BindableObject.cs:line 721
   at Microsoft.Maui.Controls.Element.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean changed, Boolean willFirePropertyChanged) in /_/src/Controls/src/Core/Element/Element.cs:line 713
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent) in /_/src/Controls/src/Core/BindableObject.cs:line 708
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity) in /_/src/Controls/src/Core/BindableObject.cs:line 625
   at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value, SetterSpecificity specificity) in /_/src/Controls/src/Core/BindableObject.cs:line 559
   at Microsoft.Maui.Controls.StyleSheets.Style.Apply(VisualElement styleable, SelectorSpecificity selectorSpecificity, Boolean inheriting) in /_/src/Controls/src/Core/StyleSheets/Style.cs:line 81
   at Microsoft.Maui.Co

With fix StyleTests

heritedStyleForTemplatedElementIsAppliedCorrectlyForContentView [2 ms]
  Passed UnapplyingStyleDefaultToImplicit2 [1 ms]
  Passed ImplicitStylesAreAppliedOnSettingRD [< 1 ms]
  Passed AddImplicitStyleToResourceDictionary [5 ms]
  Passed CreatingStyledElementsOffMainThreadShouldNotCrash [2 s]
  Passed MatchTargetTypeDoesntLogWarningMessage [1 ms]
  Passed TestTriggersAndBehaviors [3 ms]
  Passed ImplicitStylesAreAppliedToDerivedIfSpecified [< 1 ms]
  Passed StyleDontHoldStrongReferences [43 ms]
  Passed MismatchTargetTypeLogsWarningMessage2 [24 ms]
  Passed MismatchTargetTypeLogsWarningMessage1 [2 ms]
  Passed ClearValueShouldntUnapplyStyles [1 ms]
  Passed MultipleStyleClassAreApplied [1 ms]
[xUnit.net 00:00:04.09]   Finished:    Microsoft.Maui.Controls.Core.UnitTests
  Passed ImplicitStylesNotAppliedToDerivedTypesByDefault [1 ms]
  Passed UnapplyingStyleDefaultToImplicit5 [1 ms]
  Passed ImplicitStylesAppliedByDefaultIfAStyleExists [1 ms]
  Passed ReplacingResourcesDoesNotOverrideManuallySetProperties [1 ms]
  Passed MultipleStylesCanShareTheSameClassName [1 ms]
  Passed ClassStylesAreApplied [< 1 ms]
Test Run Successful.
Total tests: 57
     Passed: 57
 Total time: 4.6514 Seconds

PR head: 1d0bf7e8.

Without-fix baseline: e10376bc.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Oct 29, 2026
@kubaflo

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Tests Failure Analysis

@johnkaram02 — test-failure analysis for commit 1d0bf7e.

Scope CI failures Commit 1d0bf7e


🧪 CI Analysis — click to expand
📊 maui-pr

No failures found.


🧪 maui-pr-devicetests

🧪 maui-pr-uitests

Five target samples are partial; missing matches cannot establish passes.


🧭 Follow-up — actions and refresh

Next action: Compare matched runtimes; inspect crash dump and visual diffs.

Maintainers: comment /review tests to refresh this report.

@kubaflo
kubaflo changed the base branch from main to candidate/11.0.1xx-sr2 November 11, 2026 22:08
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>
@kubaflo

kubaflo commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Resolved both conflicts against the PR's current target, candidate/11.0.1xx-sr2, and pushed an ordinary merge commit (938a4885a8) to the original fix/css-transform-invariant-culture branch. No rebase, force-push or target change.

  • Combined invariant-culture parsing (including exponent notation) with the target's single-value transform behavior: translate(x) defaults Y to zero; scale(s) applies to both axes. Both arguments now consistently use the invariant parser.
  • Retained the PR's culture/exponent regressions and the target's two-value and CSS-disabled tests. Expanded the single-value regressions to fractional values under en-US, de-DE and fr-FR.

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

git diff --check against the target passed for both resolved files. Scoped dotnet format whitespace --verify-no-changes reported pre-existing formatting in the target's CSS-disabled test block; that unrelated block was left unchanged. No native/device tests were run. The post-push Azure DevOps query returned no newly queued builds yet, so this is not a claim that CI is green.

@kubaflo
kubaflo merged commit c8e741c into dotnet:candidate/11.0.1xx-sr2 Nov 11, 2026
2 of 3 checks passed
kubaflo added a commit that referenced this pull request Nov 13, 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 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>
kubaflo added a commit that referenced this pull request Nov 16, 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 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>
kubaflo added a commit that referenced this pull request Nov 16, 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 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>
kubaflo added a commit that referenced this pull request Nov 17, 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 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>
kubaflo added a commit that referenced this pull request Nov 18, 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 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>
kubaflo added a commit that referenced this pull request Nov 18, 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 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>
kubaflo added a commit that referenced this pull request Nov 18, 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 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>
kubaflo added a commit that referenced this pull request Nov 19, 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 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>
kubaflo added a commit that referenced this pull request Nov 22, 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 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>
kubaflo added a commit that referenced this pull request Nov 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 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants