Hello,
I ran into a scenario where clicking randomly with the mouse to change the date eventually results in a crash. It typically takes 10 or more clicks in relatively fast succession. I was not able to find a specific pattern that causes the crash. However, I can recreate it more reliably when the calendar has MaxDate set.
Here's the crash stack trace:
at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(Object key)
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at Telerik.UI.Xaml.Controls.Input.Calendar.XamlDecorationLayer.GetCalendarDecorationVisual(CalendarNode node, CalendarDecorationType decorationType)
at Telerik.UI.Xaml.Controls.Input.Calendar.XamlDecorationLayer.UpdateCalendarCellDecorations(IEnumerable`1 cellsToUpdate)
at Telerik.UI.Xaml.Controls.Input.Calendar.XamlDecorationLayer.UpdateUI(IEnumerable`1 cellsToUpdate)
at Telerik.UI.Xaml.Controls.Input.RadCalendar.UpdatePresenters(IEnumerable`1 cellsToUpdate)
at Telerik.UI.Xaml.Controls.Input.Calendar.CurrencyService.UpdatePresenters(DateTime oldCurrentDate, DateTime newCurrentDate)
at Telerik.UI.Xaml.Controls.Input.Calendar.CurrencyService.<>c__DisplayClass19_0.<
AsyncUpdateCurrencyPresenters
>b__0()
Here's the code I used:
XAML
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
ContentPage
xmlns
=
"http://xamarin.com/schemas/2014/forms"
x:Class
=
"CalendarCrash.MainPage"
xmlns:telerikInput
=
"clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"1*"
/>
<
RowDefinition
Height
=
"1*"
/>
</
Grid.RowDefinitions
>
<
telerikInput:RadCalendar
HorizontalOptions
=
"CenterAndExpand"
VerticalOptions
=
"CenterAndExpand"
x:Name
=
"calendar"
/>
<
Label
Grid.Row
=
"1"
Text
=
"Calendar crash"
HorizontalOptions
=
"CenterAndExpand"
VerticalOptions
=
"CenterAndExpand"
/>
</
Grid
>
</
ContentPage
>
Code behind:
using System;
using Xamarin.Forms;
namespace CalendarCrash
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
calendar.MaxDate = DateTime.Now;
}
}
}
Could you recommend any workaround or does this require a bug fix on your end?
11 Answers, 1 is accepted
Thank you for the provided code.
I have tested the described scenario on UWP but on my side it works fine. I have created a sample example using the latest version of Telerik UI for Xamarin and Xamarin.Forms v3.1.0.697729. Please take a look at the attached sample and let me know if you continue getting those errors.
Looking forward to your reply.
Regards,
Didi
Progress Telerik
Hello Didi, thank you for trying to recreate the scenario.
I tried updating to the latest Telerik UI for Xamarin and the latest Xamarin Forms. I can still recreate the scenario fairly easy. I'm running the app on Windows 10 Pro 1803.
I recorded a video to give you an idea about how fast I was clicking around. Unfortunately I cannot attach it here due to the 2MB and content type restrictions. Is there any other way to upload the video?
In the Forum only image attachments are allowed. In this case you can upload the video in web channel and send me a link to it.
Looking forward to your reply.
Regards,
Didi
Progress Telerik
Hi Didi, here's a link to the video.
Thank you for the video. We have managed to replicate the behavior, though it was not that easy to reproduce it on our end. We will need some more time to examine it and provide you with more information. We will update the thread once we have such from our end. In the meantime, your patience is highly appreciated.
Have a great weekend.
Regards,
Stefan Nenchev
Progress Telerik
Thank you for your patience.
We have investigated the behavior and managed to apply a fix which should deal with the issue. The fix will be available with the next release so you can test the behavior with the binaries once they are available. Here is the actual bug report, we will change the status of the item once the fix is officially included - Calendar: Switching through the cells throws KeyNotFoundException.
If you have any further questions or concerns, do not hesitate to contact us.
Regards,
Stefan Nenchev
Progress Telerik
Here is the actual bug report for Xamarin, as the previously provided is for the UI for UWP product - Calendar:[UWP] Switching through the cells throws KeyNotFoundException.
Regards,
Stefan Nenchev
Progress Telerik
I have updated your points for the report.
Have a great week.
Regards,
Stefan Nenchev
Progress Telerik