When you use the DisabledDates parameter of the picker and it is null, the component throws an error that it cannot Select from the IEnumerable:
<TelerikDatePicker @bind-Value="@theValue" DisabledDates="@DisabledDates" />
@code{
DateTime theValue { get; set; }
List<DateTime> DisabledDates { get; set; }
}
Hello,
A status update - we have reviewed this, and an exception is the expected behavior in this case. Reference types (such as lists, dates, etc.) throw a NullReferenceException when they are null but are used. We decided to keep this behavior consistent with the framework, so exceptions will continue being thrown - if you use a parameter, you should initialize the variable that it consumes.
The improvement we will make in this regard is to throw more meaningful exceptions - the default Blazor stack trace and exception messages are not very helpful and we will add the parameter name that threw the exception so that you can investigate your application logic better.
Regards,
Marin Bratanov
Progress Telerik
A workaround is to initialize the DisabledDates collection:
<TelerikDatePicker @bind-Value="@theValue" DisabledDates="@DisabledDates" />
@code{
DateTime theValue { get; set; }
List<DateTime> DisabledDates { get; set; } = new List<DateTime>();
}
Regards,
Marin Bratanov
Progress Telerik