Application crashes after adding filtering option

Dear Team,

I recently added filter functionality in SfCombo in my Xamarin forms application with suggestion mode as 'starts with'. After this, the users have reported that the application crashes when the combo is loaded. The combo is part of a contentview that is shown as the user progresses through a step progress. Basically the content view is within the content page. The problem happens only on a few devices and happens only in Release mode.


Below is the Xaml of the combo, which is bound dynamically in an await call.

DisplayMemberPath="Key" HeightRequest="50" IsEnabled="True" ShowClearButton="True"

WidthRequest="200" IsEditableMode="True" AllowFiltering="True" SuggestionMode="StartsWith"


SelectedValue="Binding {Value}, Mode=TwoWay" ComboBoxMode="Suggest" ShowSuggestionsOnFocus="False"

HorizontalOptions="FillAndExpand"

>


Below is the Stack trace of the Exception:

System.Exception: TaskSchedulerOnUnobservedTaskException ---> System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. (The operation was canceled.) ---> System.OperationCanceledException: The operation was canceled.

at System.Threading.CancellationToken.ThrowOperationCanceledException () [0x00010] in <5634a78799954994991c3b54688b25c5>:0

at System.Threading.CancellationToken.ThrowIfCancellationRequested () [0x00008] in <5634a78799954994991c3b54688b25c5>:0

at Syncfusion.Android.ComboBox.SfComboBox+<>c__DisplayClass660_1.b__1 () [0x00035] in <011e047c4a5548e9bcf5bbb669f29bcb>:0

at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <5634a78799954994991c3b54688b25c5>:0

at System.Threading.Tasks.Task.Execute () [0x00000] in <5634a78799954994991c3b54688b25c5>:0


Edit


Today we had the below message from a different device

System.Exception: CurrentDomainUnhandledException ---> Java.Lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.PopupWindow$PopupDecorView.setFitsSystemWindows(boolean)' on a null object reference

  at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0006e] in <7fc741e2408e4933a482107ae0d8458c>:0

  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in <7fc741e2408e4933a482107ae0d8458c>:0

  at Android.Widget.PopupWindow.ShowAsDropDown (Android.Views.View anchor, System.Int32 xoff, System.Int32 yoff) [0x0005a] in <60e0048867ba42d9b9810ac8ae3cf102>:0

  at Syncfusion.Android.ComboBox.SfComboBox.OpenDropDown () [0x00054] in <011e047c4a5548e9bcf5bbb669f29bcb>:0

  at Syncfusion.Android.ComboBox.SfComboBox.Run () [0x0004f] in <011e047c4a5548e9bcf5bbb669f29bcb>:0

  at Java.Lang.Runnable.Run () [0x00000] in <60e0048867ba42d9b9810ac8ae3cf102>:0

  at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <60e0048867ba42d9b9810ac8ae3cf102>:0

  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.17(intptr,intptr)


Please look into this ASAP.

Thank you,

Santhosh


5 Replies

RS Ruba Shanmugam Syncfusion Team June 9, 2022 01:13 PM UTC

Hi Santhosh,


Query 1: System.Exception: TaskSchedulerOnUnobservedTaskException


In our SfComboBox we have used the asynchronous method to search the data. For this reason, we used the cancellation of the task as per the reference below,


Link: https://docs.microsoft.com/en-us/dotnet/standard/parallel-programming/how-to-cancel-a-task-and-its-children?redirectedfrom=MSDN


A "TaskCanceledException was unhandled by user code" error will be raised here if "Just My Code" is enabled on your computer. JMC is supported on Express versions and cannot be disabled. The exception has begun. Just press F5 to continue executing your code.


Note: If the crash issue is logged in the App centre crash log, then don't worry in UI no crashes occur on the user side. Because we already handled this exception in the source.


Query 2: System.Exception: CurrentDomainUnhandledException ---> Java.Lang.NullPointerException:


We tried to replicate the reported issue and we could able to reproduce the same. Can you please check the provided sample and if you still facing the same issue, please send the sample with the replication steps. It would be helpful for providing a solution at earliest.


Regards,

Ruba Shanmugam



SK Santhosh Kumar June 10, 2022 05:47 AM UTC

Dear Ruba,


Query 1:

The application (apk) crashes for the user in his tablet. As a developer, I'm not able to reproduce this from Visual Studio IDE both in Debug and Release modes..


Query 2: I will check and get back to you. But this too happens only on the apk.


Edit

As a note, we do not use AppCenter, we use a global exception handler on the mainactivity.cs to capture any unhandled exceptions and log them to a file.


Also the combo box is within a sflistview. If that could give you some lead.

Thanks


Santhosh



RS Ruba Shanmugam Syncfusion Team June 10, 2022 12:28 PM UTC

Hi Santhosh,


Thanks for the update.


Query 1: System.Exception: TaskSchedulerOnUnobservedTaskException


We'd like to inform you that we handled an exception on our end, so the exception may be logged but not thrown on the user side. Because we are handled it on our end. Please let us know if you require any additional information on this.


Query 2: System.Exception: CurrentDomainUnhandledException ---> Java.Lang.NullPointerException:


We will wait until here from you for proceeding further on this.


Regards,

Ruba Shanmugam



SK Santhosh Kumar June 20, 2022 06:55 AM UTC

Dear Ruba,


The crash happens when the combobox is put inside a sfListview and when the user scrolls the listview back and forth. There is some problem when the list view items come into visibility.

I have removed the search functionality from the combo that are inside the sflistview. You may take this as a case and look for a solution in future releases. This query can be closed for now.


Thanks


Santhosh



RS Ruba Shanmugam Syncfusion Team June 21, 2022 10:39 AM UTC

Hi Santhosh,


We have logged an improvement task for getting better performance of searching the data with asynchronous in SfComboBox, it can be tracked through our feedback portal below. 


Feedback link: https://www.syncfusion.com/feedback/10805/need-to-improve-the-asynchronous-method-to-search-the-data-in-sfcombobox 


Please cast your vote to make it count. We will prioritize the features every release based on the demands and we do not have an immediate plan to implement this feature since we committed to already planned work. So, this feature will be available for any of our upcoming releases.


If you have any more specifications/suggestions for the feature request, you can add it as a comment in the portal.


Regards,

Ruba Shanmugam


Loader.
Up arrow icon