My app is .NetCore 5 I am developing blazor webassembly with Syncfusion components ver v18.4.31
When I try to use SfDateRangePicker picker with two way binding I am getting error and my app crash.
Error occurs on initial loading of page, before any user interaction
Error I get looks like
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Syncfusion.Blazor.Calendars.SfDateRangePicker`1[[System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].UpdateIconState()
at Syncfusion.Blazor.Calendars.SfDateRangePicker`1.d__587[[System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at Syncfusion.Blazor.Calendars.SfDateRangePicker`1.d__541[[System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
Here is how my test page looks like
@page "/test"
@using Syncfusion.Blazor
@using Syncfusion.Blazor.Calendars
SfDateRangePicker Width="250px" StrictMode="true" AllowEdit="false" ShowClearButton="false" TValue="DateTime?" FirstDayOfWeek="1" @bind-StartDate="@OdDatuma" @bind-EndDate="@DoDatuma"
DateRangePickerEvents TValue="DateTime?" OnClose="RangeSelectHandler">
SfDateRangePicker
@code {
public DateTime? OdDatuma { get; set; } = DateTime.Now;
public DateTime? DoDatuma { get; set; } = DateTime.Now;
public void RangeSelectHandler(RangePopupEventArgs args)
{
Console.WriteLine(args.Date);
}
}
Any tip what I am doing wrong?
Does this error is related with localization , In startup (Program.cs) I do set culture to my local
var cuif = new CultureInfo("hr_BA");
cuif.NumberFormat.CurrencySymbol = "KM";
cuif.DateTimeFormat.MonthNames = new string[] {"janar","februar","mart","april","maj","juni","juli","august","septembar","okotobar","novmbar","decembar","" };
cuif.DateTimeFormat.AbbreviatedMonthNames = new string[] { "janar", "februar", "mart", "april", "maj", "juni", "juli", "august", "septembar", "okotobar", "novmbar", "decembar", "" };
cuif.DateTimeFormat.AbbreviatedMonthGenitiveNames = new string[] { "janar", "februar", "mart", "april", "maj", "juni", "juli", "august", "septembar", "okotobar", "novmbar", "decembar", "" };
CultureInfo.CurrentCulture = cuif;
CultureInfo.CurrentUICulture = cuif;
CultureInfo.DefaultThreadCurrentCulture = cuif;
Attachment:
Counter_3e6fbe30.zip