SfDateRangePicker calendar icon throws System.IndexOutOfRangeException

Hello dear forum,

I'm using syncfusion version 19.3.0.43 and have a strange behavior with date range picker.

See the below code.

<SfButton class="nav-link btn btn-rounded e-default" Content="Clear" @onclick="ClearFilter">

<SfDateRangePicker FirstDayOfWeek="1" TValue="DateTime?"

                       @bind-StartDate="@StartDate"

                       @bind-EndDate="@EndDate"></SfDateRangePicker>


@code{

private void ClearFilter()

        {

             StartDate = null;

             EndDate = null;

        }

}

Could you please give some advise regarding following questions:

  1. Is it possible to have null as default values for StartDate and EndDate, on component init or render?
  2. Also, when I clear programmatically the StartDate and EndDate, via button click event, and getting bellow exception. It works properly if I clean manually the control, though. What do I have to do to prevent the error?


System.IndexOutOfRangeException: Index was outside the bounds of the array.

   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendAttributeDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)

   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, Int32 newFrameIndex)

   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)

   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, Int32 newFrameIndex)

   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)

   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, Int32 newFrameIndex)

   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)

   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer renderer, RenderBatchBuilder batchBuilder, Int32 componentId, ArrayRange`1 oldTree, ArrayRange`1 newTree)

   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)

   at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)

   at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()


Thanks in advance


5 Replies

SP Sureshkumar P Syncfusion Team May 20, 2022 11:27 AM UTC

Based on your shared information with the code example, we have validated your 2 requirements with the 19.3.0.43 version, and the reported issue is not replicated on our end.

Please find the sample in the attachment:

If still, you have faced the same issue, then please replicate the reported issue in the attached sample and revert us with a detailed issue replication procedure. These details will help us provide an exact solution as early as possible.


Attachment: DateRangePickerOthermonth_1102a0eb.zip


RL Roman Levinta May 20, 2022 02:04 PM UTC

Hello SureshKumar,

Thanks for the sample.

I've been able to find the issue by comparing both code files.

Apparently, the exception occurs because of the Placeholder attribute.

If I added that to your sample, it crashes as well.

Same use case:

  1. load the page
  2. click Clear button (optional, actually)
  3. click calendar button




SP Sureshkumar P Syncfusion Team May 23, 2022 06:22 AM UTC

Hi Roman,

Thanks for your shared information, we have resolved this issue internally and moved the fix in our 2021 volume 4 main release (19.4.38) onwards. We suggest you upgrade to our latest version to resolve the issue.

Find the sample in the latest version in the attachment:

Regards,

Sureshkumar P


Attachment: DateRangePickerOthermonth_28c7cc5b.zip


AL Alex May 25, 2023 02:44 PM UTC

This is still an issue with 20.4.0.38 as shown below on ipad.  We removed the placeholder values and the issue 




PK Priyanka Karthikeyan Syncfusion Team May 27, 2023 04:49 AM UTC

Hi Alex,

We have checked your reported issue in version 20.4.0.38. However, we were unable to reproduce the issue on our end. We suspect that the cache is being maintained on your end. So, we suggest that you remove the nuget cache and try to run the sample. If the problem persists, can you please share the replicated sample of the issue and a video illustration if possible, and also share your device information? This information will help us gain a better understanding of the problem.

Regards,

Priyanka k


Loader.
Up arrow icon