Closed
Description
Describe the bug
ConstrainedBox
crashes with all cultures not using '.' as the decimal separator.
Reason
ConvertToAspectRatio
in AspectRatio
uses Convert.ToDouble
which is region/culture-sensitive.
The method will crash if you try to parse "1.666" if the region is France, Italy or other regions not using '.' as the decimal separator.
Instead, the method should use:
double value = double.Parse(number, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture);
- Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:
Steps to Reproduce
Steps to reproduce the behavior:
- Switch the region to France or Italy and set
Regional Format
to France, Italy or Recommended - Launch a test app with a
ConstrainedBox
control - See crash
Expected behavior
Not crash :)
Screenshots
Environment
NuGet Package(s): 7.1.0-rc1
Package Version(s):
Windows 10 Build Number:
- Fall Creators Update (16299)
- April 2018 Update (17134)
- October 2018 Update (17763)
- May 2019 Update (18362)
- May 2020 Update (19041)
- Insider Build (won't disclosure)
App min and target version:
- Fall Creators Update (16299)
- April 2018 Update (17134)
- October 2018 Update (17763)
- May 2019 Update (18362)
- May 2020 Update (19041)
- Insider Build (won't disclosure)
Device form factor:
- Desktop
- Xbox
- Surface Hub
- IoT
Visual Studio version:
- 2017 (15.{minor_version})
- 2019 (16.{minor_version})
- 2022 (17.{minor_version})