On Uwp, setting certain bound valid values for CornerRadius can cause the button to crash.
This occurs on the latest pre-release as well as current Xamarin.Forms
The radius changes.
An exception is thrown claiming an invalid value for TopLeft. The exception is below:
{System.ArgumentException: Invalid value for TopLeft property on CornerRadius.
at Windows.UI.Xaml.CornerRadius.Validate(Double topLeft, Double topRight, Double bottomRight, Double bottomLeft)
at Xamarin.Forms.Platform.UWP.FormsButton.UpdateBorderRadius()
at Xamarin.Forms.Platform.UWP.FormsButton.OnBorderRadiusChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at Xamarin.Forms.Platform.UWP.TaskExtensions.<>c.b__2_1(Object e)
at System.Threading.WinRTSynchronizationContextBase.Invoker.InvokeCore()}
This occurs only on Uwp and is confirmed as non-reproducible on Android.
Hard-coding the CornerRadius to 5 does not trigger the issue.
A CornerRadius of both 4 and 6 work in the above scenario
If the HeightRequest and WidthRequest change, the exact value that triggers the crash changes as well.
Found while trying to make a rounded button.
Version with issue:
Xamarin.Forms Version 3.1.0.637273
Xamarin.Forms Version 3.2.0.637442-pre1
Last known good version: Unknown
Nuget Packages:
Both the current version and the pre-release have been tested and confirmed with this issue.
Xamarin.Forms Version 3.1.0.637273
Microsoft.NETCore.UniversalWindowsPlatform 6.1.5
and
Xamarin.Forms Version 3.2.0.637442-pre1
Microsoft.NETCore.UniversalWindowsPlatform 6.2.0-Preview1-26502-02
Affected Devices:
Dell Latitude 7270
This is related to a very old very stupid default value coming back to haunt us. The value should always be 5 that triggers the crash best I can tell.
Having double-checked, I agree that the only value that triggers the crash is 5. I thought I saw others when I first spotted the bug, but I think I perhaps only got partway through typing '50' or somesuch.