Skip to content

[net11] Fix culture-dependent FontSize design-time validation - #39691

Merged
kubaflo merged 1 commit into
dotnet:net11.0from
noiseonwires:fix/fontsize-invariant-culture-main
Oct 27, 2026
Merged

kubaflo merged 1 commit into
dotnet:net11.0from
noiseonwires:fix/fontsize-invariant-culture-main

Conversation

@noiseonwires

Copy link
Copy Markdown
Member

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

Fix MAUI's design-time FontSize validation so XAML numeric literals are validated using invariant culture, independently of Windows regional settings.

The XAML language service uses the design-time converter supplied by MAUI. Its numeric validation currently calls the current-culture double.TryParse overload, while MAUI's runtime and XAML compiler use NumberStyles.Number with CultureInfo.InvariantCulture. Under fr-FR, or an en-US culture with the decimal separator customized to a comma, valid XAML such as FontSize="12.5" is rejected with XLS0431 even though the app builds and runs.

  • Use the same invariant numeric parsing settings as the runtime and XAML compiler.
  • Add 13 regression cases covering en-US, fr-FR, de-DE, invariant decimals and grouping, rejection of localized decimal/grouping combinations, and a custom comma-decimal regional setting.
  • Restore the original culture in finally so tests do not leak culture changes.
  • Preserve runtime grouping semantics: 12,5 is not a localized spelling of 12.5; the runtime interprets it as 125. This PR does not change runtime parsing or the XAML language server.

Issues Fixed

Decimal FontSize values can produce false XLS0431 diagnostics and interfere with XAML Hot Reload when the host uses comma-decimal regional settings.

Reproduction: change the Windows decimal separator to a comma, restart Visual Studio, debug a MAUI Windows app, and edit a label to use FontSize="12.5". A full de-DE locale alone may not reproduce the rejection because its period grouping separator lets the old validator accept the text.

Validation

dotnet test src\Controls\tests\Core.Design.UnitTests\Controls.Core.Design.UnitTests.csproj --no-restore --filter FullyQualifiedName~FontSizeDesignTypeConverterTests
  • Before the production fix: 5 failed, 29 passed (34 total).
  • After the production fix: 34 passed, 0 failed.
  • dotnet format whitespace verification passed for both changed files.
  • git diff --check passed.
  • Direct execution of the shipped 10.0.110 design-time/runtime converters independently confirmed the mismatch during investigation.

Tests build and run the actual net472 design tooling on Windows. A complete Visual Studio Hot Reload session was not exercised locally.

A matching .NET 10 fix is being submitted separately against inflight/current.

Validate numeric font sizes using invariant culture and the same number style as the runtime and XAML compiler. Add regression coverage for decimal values, grouping, and custom regional settings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 27, 2026 10:48
@azure-pipelines

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

@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 -- 39691

Or

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

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

Copy link
Copy Markdown
Contributor

Hey there @@noiseonwires! 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 @noiseonwires! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@github-actions github-actions Bot added area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging platform/windows labels Oct 27, 2026
@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 27, 2026
@azure-pipelines

This comment has been minimized.

Copilot AI 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.

🔵 Needs a closer look

No code defects were identified, but CI status and the reported Windows net472 test results remain independently unverified.

No open issues 🎉

What changed in this PR

This PR fixes culture-dependent FontSize validation in MAUI’s design-time tooling so valid XAML numeric literals are not rejected because of regional settings.

Changes:

  • Uses NumberStyles.Number with invariant culture for numeric validation, matching runtime and XAML compiler parsing.
  • Adds 13 regression cases covering multiple cultures and a customized decimal separator, restoring the original culture after each test.
File Description
src/​Controls/​tests/​Core.Design.UnitTests/​FontSizeDesignTypeConverterTests.cs Adds culture-independent numeric validation regression tests.
src/​Controls/​src/​Core.Design/​FontSizeDesignTypeConverter.cs Switches numeric validation to invariant-culture parsing.

Review effort: Balanced

@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 de5e6a4.

@MauiBot

MauiBot commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

PR Test Gate

@noiseonwires — existing-test verification for commit de5e6a4b.

Result INCONCLUSIVE Platform Windows Commit de5e6a4b


🧪 Gate analysis — click to expand

⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect.

No interpretable test-group summary was produced. No additional test execution is inferred.

Execution log excerpts

Execution

📁 Output directory: CustomAgentLogsTmp/PRState/39691/PRAgent/gate/verify-tests-fail
🔍 Detecting base branch and merge point...
⚠️  Could not resolve base branch for PR #39691; falling back to auto-detect
No PR detected, scanning remote branches for closest base...
✅ Base branch: main (via closest-merge-base)
✅ Merge base commit: b20099cf
   (1 commits ahead of main)
╔═══════════════════════════════════════════════════════════╗
║         FULL VERIFICATION MODE                            ║
╠═══════════════════════════════════════════════════════════╣
║  Fix files detected - will verify:                        ║
║  1. Tests FAIL without fix                                ║
║  2. Tests PASS with fix                                   ║
╚═══════════════════════════════════════════════════════════╝
✅ Fix files (1):
   - src/Controls/src/Core.Design/FontSizeDesignTypeConverter.cs
🔍 Auto-detecting test filter from changed test files...
✅ Auto-detected 1 test(s):
   🧪 [UnitTest] FontSizeDesignTypeConverterTests (filter: FontSizeDesignTypeConverterTests)
[2026-10-27 11:11:10] ==========================================
[2026-10-27 11:11:10] Verify Tests Fail Without Fix
[2026-10-27 11:11:10] ==========================================
[2026-10-27 11:11:10] Tests detected: 1
[2026-10-27 11:11:10]   - [UnitTest] FontSizeDesignTypeConverterTests (filter: FontSizeDesignTypeConverterTests)
[2026-10-27 11:11:10] Platform: windows
[2026-10-27 11:11:10] FixFiles: src/Controls/src/Core.Design/FontSizeDesignTypeConverter.cs
[2026-10-27 11:11:10] BaseBranch: main
[2026-10-27 11:11:10] MergeBase: b20099cf14ba63d3bea537fa7dc21f2c9474ce53
[2026-10-27 11:11:10] 
[2026-10-27 11:11:10] Verifying fix files are present (on disk or at merge-base)...
[2026-10-27 11:11:10]   ✓ src/Controls/src/Core.Design/FontSizeDesignTypeConverter.cs exists
[2026-10-27 11:11:10] 
[2026-10-27 11:11:10] Checking which fix files exist at merge-base (b20099cf)...
[2026-10-27 11:11:10]   ✓ src/Controls/src/Core.Desi

PR head: de5e6a4b.

Without-fix baseline: b20099cf.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Oct 27, 2026
kubaflo pushed a commit that referenced this pull request Oct 27, 2026
…ion (#39694)

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

.NET 10 backport of #39691 (targeting `main`).

Fix MAUI's design-time `FontSize` validation so XAML numeric literals
are validated using invariant culture, independently of Windows regional
settings.

The XAML language service uses the design-time converter supplied by
MAUI. Its numeric validation calls the current-culture `double.TryParse`
overload, while MAUI's runtime and XAML compiler use
`NumberStyles.Number` with `CultureInfo.InvariantCulture`. Under
`fr-FR`, or an `en-US` culture with the decimal separator customized to
a comma, valid XAML such as `FontSize="12.5"` is rejected with XLS0431
even though the app builds and runs.

- Use the same invariant numeric parsing settings as the runtime and
XAML compiler.
- Add 13 regression cases covering `en-US`, `fr-FR`, `de-DE`, invariant
decimals and grouping, rejection of localized decimal/grouping
combinations, and a custom comma-decimal regional setting.
- Restore the original culture in `finally` so tests do not leak culture
changes.
- Preserve runtime grouping semantics: `12,5` is not a localized
spelling of 12.5; the runtime interprets it as 125. Runtime parsing and
the XAML language server are unchanged.

The source and test changes are identical to #39691; the converter and
tests are unchanged between `main` and `inflight/current`.

### Issues Fixed

Decimal `FontSize` values can produce false XLS0431 diagnostics and
interfere with XAML Hot Reload when the host uses comma-decimal regional
settings.

Reproduction: change the Windows decimal separator to a comma, restart
Visual Studio, debug a MAUI Windows app, and edit a label to use
`FontSize="12.5"`. A full `de-DE` locale alone may not reproduce the
rejection because its period grouping separator lets the old validator
accept the text.

### Validation

```powershell
dotnet test src\Controls\tests\Core.Design.UnitTests\Controls.Core.Design.UnitTests.csproj --filter FullyQualifiedName~FontSizeDesignTypeConverterTests
```

- Before the production fix: 5 failed, 29 passed (34 total).
- After the production fix: 34 passed, 0 failed.
- `dotnet format whitespace` verification passed for both changed files.
- `git diff --check` passed.

Tests build and run the actual `net472` design tooling on Windows, on
top of `inflight/current` (4606786). A complete Visual Studio Hot
Reload session was not exercised locally.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kubaflo
kubaflo changed the base branch from main to net11.0 October 27, 2026 13:49
@kubaflo
kubaflo merged commit 426ad52 into dotnet:net11.0 Oct 27, 2026
176 of 211 checks passed
@github-actions github-actions Bot added this to the .NET 11.0-rc2 milestone Oct 27, 2026
kubaflo added a commit that referenced this pull request Oct 27, 2026
Merge the exact published net11.0 tip 426ad52 without flattening or duplicating upstream fixes. Incoming history contains only merged WebView PR #39695 and FontSize PR #39691. All three incoming files had no inflight overlap and merge cleanly; retain every prior corrective commit and inflight-only ancestor.

Own-head RTM Android CoreCLR build 1650804 log 123 and Helix403dab35 show the clipping regression as the sole Controls failure (1328 passed, 1 failed, 13 skipped), while all 33 derived Window cases passed. The merged handler matches upstream blob 826a528 exactly. Actual converter-source portable CoreCLR probe passed 13 incoming culture cases plus 4 preserved invariants; original Windows/net472 tests are locally blocked by MSB3644. Whitespace, exact source, clean index and unchanged 11.0.10 version configuration checks passed. Fresh exact-head native/Windows CI remains required.

Source-Commit: 1dfcadc
Source-Commit: 426ad52
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 87b27872-6f30-4208-af18-f1e6de6ff66c
github-actions Bot pushed a commit that referenced this pull request Oct 28, 2026
…ion (#39694)

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

.NET 10 backport of #39691 (targeting `main`).

Fix MAUI's design-time `FontSize` validation so XAML numeric literals
are validated using invariant culture, independently of Windows regional
settings.

The XAML language service uses the design-time converter supplied by
MAUI. Its numeric validation calls the current-culture `double.TryParse`
overload, while MAUI's runtime and XAML compiler use
`NumberStyles.Number` with `CultureInfo.InvariantCulture`. Under
`fr-FR`, or an `en-US` culture with the decimal separator customized to
a comma, valid XAML such as `FontSize="12.5"` is rejected with XLS0431
even though the app builds and runs.

- Use the same invariant numeric parsing settings as the runtime and
XAML compiler.
- Add 13 regression cases covering `en-US`, `fr-FR`, `de-DE`, invariant
decimals and grouping, rejection of localized decimal/grouping
combinations, and a custom comma-decimal regional setting.
- Restore the original culture in `finally` so tests do not leak culture
changes.
- Preserve runtime grouping semantics: `12,5` is not a localized
spelling of 12.5; the runtime interprets it as 125. Runtime parsing and
the XAML language server are unchanged.

The source and test changes are identical to #39691; the converter and
tests are unchanged between `main` and `inflight/current`.

### Issues Fixed

Decimal `FontSize` values can produce false XLS0431 diagnostics and
interfere with XAML Hot Reload when the host uses comma-decimal regional
settings.

Reproduction: change the Windows decimal separator to a comma, restart
Visual Studio, debug a MAUI Windows app, and edit a label to use
`FontSize="12.5"`. A full `de-DE` locale alone may not reproduce the
rejection because its period grouping separator lets the old validator
accept the text.

### Validation

```powershell
dotnet test src\Controls\tests\Core.Design.UnitTests\Controls.Core.Design.UnitTests.csproj --filter FullyQualifiedName~FontSizeDesignTypeConverterTests
```

- Before the production fix: 5 failed, 29 passed (34 total).
- After the production fix: 34 passed, 0 failed.
- `dotnet format whitespace` verification passed for both changed files.
- `git diff --check` passed.

Tests build and run the actual `net472` design tooling on Windows, on
top of `inflight/current` (4606786). A complete Visual Studio Hot
Reload session was not exercised locally.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 27, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — de5e6a4b Deployed Oct 27, 2026 by noiseonwires via conclusion #2530
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging community ✨ Community Contribution platform/windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants