Crash when confirm filter

Image_8960_1727258444191

When press ok button,I got the following crash.

Index was outside the bounds of the array.
   at Syncfusion.UI.Xaml.Spreadsheet.History.HistoryTransactionCommand..ctor(SfSpreadsheet sfSpreadsheet, IRange[] ranges, GridCurrentCell currentCell)
   at Syncfusion.UI.Xaml.Spreadsheet.History.HistoryManager.CommitTransaction()
   at Syncfusion.UI.Xaml.Spreadsheet.CheckboxFilterControl.InvokeCheckboxFilter()
   at Syncfusion.UI.Xaml.Spreadsheet.SpreadsheetFilterControl.OnFilterOkButtonClick(Object sender, RoutedEventArgs e)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)



After filling in the table data, I use the following code to set the FilterRange.

// set filter

        if (worksheet.AutoFilters.FilterRange != null)

        {

            worksheet.AutoFilters.FilterRange = null;

        }


        var filterRange = worksheet.Range[Const.TitleRowCount, 1, newMaxRow, lastMaxColumn];

        filterRange.NumberFormat = "@";

        worksheet.AutoFilters.FilterRange = filterRange;


Am I doing this correctly?



9 Replies

MS Malini Selvarasu Syncfusion Team September 26, 2024 02:12 PM UTC

Hi crosslife,

Based on the information provided, we understand that an exception is being encountered when filtering data in SfSpreadsheet. We have developed a simple sample to attempt to replicate the issue, but we were unable to reproduce the problem on our end, as the SfSpreadsheet displayed correctly without any exceptions.
To assist you more effectively, we need further details about the reported scenario. Specifically, could you provide the following information:
1. Data Sheet: Could you please share your Excel sheet along with details about `Const.TitleRowCount`, `newMaxRow`, and `lastMaxColumn`?
2. Video or Screenshots: If possible, please share a video or screenshots demonstrating the issue.

This information will help us better understand the problem and work towards finding a solution promptly. Thank you for your cooperation.
Regards,
Malini Selvarasu


CR crosslife September 29, 2024 08:04 AM UTC

I made a simple demo with recording.


First, there is a high probability of a crash even during the first filtering. 

Second, after resetting the data and setting the FilterRange, the  does not refresh.


Attachment: CrashDemo_db391fe8.zip



MS Malini Selvarasu Syncfusion Team September 30, 2024 02:01 PM UTC

Hi crosslife,

Thank you for sharing the demo. We have successfully replicated the issue on our end. After analyzing the problem, we suspect it might be a bug. To further investigate, we need to examine it at the source level. Consequently, we will need some additional time for validation and will provide an update by October 04, 2024.
We appreciate your patience and understanding until then.
Regards,
Malini Selvarasu


MS Malini Selvarasu Syncfusion Team October 4, 2024 03:13 PM UTC

Hi crosslife,

We have created a bug report for the reported issue “An IndexOutOfRange Exception was thrown while filtering the data without a selection in SfSpreadsheet”. We will include this fix in our upcoming Weekly NuGet release which is scheduled for October 29, 2024.

We will update you with the feedback details on October 07,2024.

Regards,
Malini Selvarasu


MS Malini Selvarasu Syncfusion Team October 7, 2024 02:02 PM UTC

Hi  crosslife,
As we mentioned earlier, We have created a bug report for the reported issue “An IndexOutOfRange Exception was thrown while filtering the data without a selection in SfSpreadsheet”. We will include this fix in our upcoming Weekly NuGet release which is scheduled for October 29, 2024.
You can track the status of this report through the following feedback link,
Note: The provided feedback link is private, and you need to log in to view this feedback.
We will let you know once it is released. We appreciate your patience until then.
Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.
Regards,
Malini Selvarasu


MS Malini Selvarasu Syncfusion Team October 29, 2024 02:50 PM UTC

Hi crosslife,

Unfortunately, we were unable to include the fix for the issue of “An IndexOutOfRange Exception being thrown while filtering the data without a selection in SfSpreadsheet” in the NuGet package released today, as promised.
When filtering the data without a selection in SfSpreadsheet, the selected ranges are empty, which leads to the reported issue. We have found the solution for this scenario, currently we are in testing phase. As a result, we were unable to include the fix for this issue in the current NuGet package as promised. We will incorporate these changes in our weekly NuGet release, scheduled for November 12, 2024.
Regards,
Malini Selvarasu


MS Malini Selvarasu Syncfusion Team November 12, 2024 02:14 PM UTC

Hi crosslife,

Due to the 2024 Volume 3 SP release, there is no weekly NuGet release this week. Unfortunately, we were unable to include a fix for the issue, "An IndexOutOfRangeException is thrown while filtering data without a selection in SfSpreadsheet" in our upcoming 2024 Volume 3 SP release.

As mentioned earlier, during the testing phase, we identified an issue where the current cell does not update as expected. We are currently addressing this and will implement a fix in our first weekly NuGet release following the 2024 Volume 3 SP release.
We will let you know once it is released. We appreciate your patience until then.
Thank you for your understanding and cooperation.
Regards,
Malini Selvarasu


MS Malini Selvarasu Syncfusion Team November 22, 2024 09:27 AM UTC

Hi crosslife,

We regret the inconvenience caused. Unfortunately, we were unable to include the fix for the issue of "An IndexOutOfRange Exception being thrown while filtering the data without a selection in SfSpreadsheet" in the NuGet package released today, as promised.


As mentioned earlier, this issue occurs because the selection is cleared at the sample level before performing programmatic filtering. If the selection is not cleared, the exception will not occur. We are actively working on implementing a default range selection when the selection is cleared. These changes will be included in our weekly NuGet release, scheduled for November 26, 2024.


In the meantime, we recommend filtering the data without clearing the selection during the button click, as the selected range is required for filtering in the spreadsheet.


We will notify you as soon as the release is available. We appreciate your patience and understanding. Thank you for your cooperation.


Regards,
Malini Selvarasu


MS Malini Selvarasu Syncfusion Team November 26, 2024 01:11 PM UTC

Hi crosslife,

We would like to let you know that Essential Studio Weekly NuGet packages (v27.2.4) has been published in nuget.org with the fix for the issue “An IndexOutOfRange Exception being thrown while filtering the data without a selection in SfSpreadsheet”. Please let us know if you have any concerns in this.

Root Cause:
We have accessed the selected range for redo or undo operations, but when we perform a programmatic selection, the selected ranges are empty, which leads to the reported issue. To fix this, we now use FirstOrDefault() from a LINQ query instead of index-based access.

Regards,
Malini Selvarasu

Loader.
Up arrow icon