ArgumentException in Com.Syncfusion.Autocomplete.SfAutoComplete.GetSelectedData

Hello,

I just came across this exception. I am afraid I cannot duplicate it but I was not interacting with an SfAutocomplete  control directly, neither did I change any of the lists that are bound to it. I am using 16.2.0.41

Here is the stack trace.

07-19 15:11:19.806 I/MonoDroid(21263): System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds
07-19 15:11:19.806 I/MonoDroid(21263):   at System.Array.Copy (System.Array sourceArray, System.Int32 sourceIndex, System.Array destinationArray, System.Int32 destinationIndex, System.Int32 length) [0x000da] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
07-19 15:11:19.806 I/MonoDroid(21263):   at System.Collections.Generic.List`1[T].CopyTo (T[] array, System.Int32 arrayIndex) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
07-19 15:11:19.806 I/MonoDroid(21263):   at System.Collections.Generic.List`1[T].InsertRange (System.Int32 index, System.Collections.Generic.IEnumerable`1[T] collection) [0x000aa] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
07-19 15:11:19.806 I/MonoDroid(21263):   at System.Collections.Generic.List`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] collection) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
07-19 15:11:19.806 I/MonoDroid(21263):   at Com.Syncfusion.Autocomplete.SfAutoComplete.GetSelectedData (System.String compareText, System.Boolean selected) [0x00015] in <9e2539381fed490cb639522ebce9405c>:0 
07-19 15:11:19.806 I/MonoDroid(21263):   at Com.Syncfusion.Autocomplete.SfAutoComplete.SelectedListData (System.Collections.Generic.IEnumerable`1[T] dataItems) [0x00164] in <9e2539381fed490cb639522ebce9405c>:0 
07-19 15:11:19.806 I/MonoDroid(21263):   at Com.Syncfusion.Autocomplete.SfAutoComplete.SelectedItemMethod () [0x0008d] in <9e2539381fed490cb639522ebce9405c>:0 
07-19 15:11:19.806 I/MonoDroid(21263):   at Com.Syncfusion.Autocomplete.SfAutoComplete.set_SelectedItem (System.Object value) [0x00045] in <9e2539381fed490cb639522ebce9405c>:0 
07-19 15:11:19.806 I/MonoDroid(21263):   at Syncfusion.SfAutoComplete.XForms.Droid.SfAutoCompleteMapping.OnAutoCompletePropertiesChanged (System.String propertyName, Syncfusion.SfAutoComplete.XForms.SfAutoComplete formsAutoComplete, Com.Syncfusion.Autocomplete.SfAutoComplete nativeAutoComplete) [0x00b90] in <84d487a0d7054ca9b6ed63d98aa6792e>:0 
07-19 15:11:19.806 I/MonoDroid(21263):   at Syncfusion.SfAutoComplete.XForms.Droid.SfAutoCompleteRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00013] in <84d487a0d7054ca9b6ed63d98aa6792e>:0 
07-19 15:11:19.806 I/MonoDroid(21263):   at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
07-19 15:11:19.806 I/MonoDroid(21263):   at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x0000a] in D:\agent_work\1\s\Xamarin.Forms.Core\BindableObject.cs:146 
07-19 15:11:19.806 I/MonoDroid(21263):   at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\agent_work\1\s\Xamarin.Forms.Core\Element.cs:401 
07-19 15:11:19.807 I/MonoDroid(21263):   at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00107] in D:\agent_work\1\s\Xamarin.Forms.Core\BindableObject.cs:602 
07-19 15:11:19.807 I/MonoDroid(21263):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\agent_work\1\s\Xamarin.Forms.Core\BindableObject.cs:399 
07-19 15:11:19.807 I/MonoDroid(21263):   at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x001f9] in D:\agent_work\1\s\Xamarin.Forms.Core\BindingExpression.cs:174 
07-19 15:11:19.807 I/MonoDroid(21263):   at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in D:\agent_work\1\s\Xamarin.Forms.Core\BindingExpression.cs:56 
07-19 15:11:19.807 I/MonoDroid(21263):   at Xamarin.Forms.BindingExpression+BindingExpressionPart.<PropertyChanged>b__47_0 () [0x00000] in D:\agent_work\1\s\Xamarin.Forms.Core\BindingExpression.cs:547 
07-19 15:11:19.807 I/MonoDroid(21263):   at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <263adecfa58f4c449f1ff56156d886fd>:0 
07-19 15:11:19.807 I/MonoDroid(21263):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <263adecfa58f4c449f1ff56156d886fd>:0 
07-19 15:11:19.807 I/MonoDroid(21263):   at (wrapper dynamic-method) System.Object.1a7d831e-faf9-4352-8714-9eaa2e173a53(intptr,intptr)

Thanks,
Jose

3 Replies

PA Paul Anderson S Syncfusion Team July 20, 2018 09:09 AM UTC

Hi Jose, 
 
Thank you for contacting Syncfusion Support, 
We could not able to reproduce " AutoComplete getting crashed with Argument exceptions" reported issue in our side. We have prepared a sample and have checked the reported issue. Please have the sample from the below link. 
 
 
Please check with the sample and if the issue still persists please modify the same with the issue reproducing steps and also mention in which scenario [initial rendering, filtering, selection, SelectedItem binding] you could reproduce the issue which will be helpful for us to analyze further and provide an appropriate solution. Please share the below requested details if possible. 
 
1)      Device details 
2)      Video demo 
3)      Whether working with older Syncfusion versions and if so the version number. 
 
Regards, 
Paul Anderson 



JO Jose July 24, 2018 03:41 PM UTC

Hi Paul,

I understand, I am not able to duplicate the issue on my side consistently. It just happens. Today I came across a variation of the same exception and I think this may be a clue. I pasted a line of text in the SfAutoComplete using Vysor and got the following exception:

Xamarin caused by: android.runtime.JavaProxyThrowable: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  at (wrapper dynamic-method) System.Object.3b32d260-dff4-449a-a662-d9ca6ce71f6a(intptr,intptr,intptr,intptr)
	at md5fde8c6fc4a8c39be3423a3807afda47d.SfAutoComplete.n_onTouch(Native Method)
	at md5fde8c6fc4a8c39be3423a3807afda47d.SfAutoComplete.onTouch(SfAutoComplete.java:68)
	at android.view.View.dispatchTouchEvent(View.java:10914)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2836)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2512)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2842)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2527)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2842)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2527)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2842)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2527)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2842)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2527)
	at android.widget.PopupWindow$PopupDecorView.dispatchTouchEvent(PopupWindow.java:2515)
	at android.view.View.dispatchPointerEvent(View.java:11147)
	at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5208)
	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5057)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4578)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4631)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4597)
	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4734)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4605)
	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4791)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4578)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4631)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4597)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4605)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4578)
	at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7191)
	at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7123)
	at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7084)
	at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7302)
	at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
	at android.os.MessageQueue.nativePollOnce(Native Method)
	at android.os.MessageQueue.next(MessageQueue.java:323)
	at android.os.Looper.loop(Looper.java:136)
	at android.app.ActivityThread.main(ActivityThread.java:6823)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1557)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
I suppose this is a race condition caused by the rapid insertion of characters when filtering a large list of items. I am using the latest version of the component. I hope this helps.


PA Paul Anderson S Syncfusion Team July 25, 2018 10:42 AM UTC

Hi Jose, 
 
We checked the reported issue "Argument exception in Syncfusion autocomplete" and we are unable to reproduce the issue from our side. We have already faced this kind of argument exception issue in the sfautocomplete control previously and we have fixed that issue.  
 
The fix will be available in the upcoming Volume 2 SP1 release, which is expected to be rolled out in a couple of days [End of July 2018]. Please check with the latest version once rolled out and let us know. 
 
Regards, 
Paul Anderson 


Loader.
Up arrow icon