ArgumentOutOfRangeException with a dinamically populated SfAutoComplete

Hello,

I just updated to the latest (16.2.0.41) and started getting this exception on something that was working correctly with the previous version.

This is the XAML:

<xForms:SfAutoComplete Margin="3,10,3,0"
   DataSource="{Binding MyList}"
   Text="{Binding MyValue}">
</xForms:SfAutoComplete>

The ViewModel

private string _myValue;
public string MyValue
{
get => _myValue;
set
{
if (!string.IsNullOrEmpty(value) && _myValue != value && value.Length >= 3)
Task.Run(async () => await RefreshList(value));
SetProperty(ref _myValue, value);

}
}

private async Task RefreshList(string newSearch)
{
var list = await _autoCompleteService.GetListOfStrings(newSearch);
_deviceService.BeginInvokeOnMainThread(() => MyList = list);
}

I start by typing a few values in the AutoComplete and at a certain point it shows the list with the filtered search. I then press one of the items in the list and I get this exception:

06-27 14:43:48.236 I/MonoDroid(13254): UNHANDLED EXCEPTION:
06-27 14:43:48.247 I/MonoDroid(13254): System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
06-27 14:43:48.247 I/MonoDroid(13254): Parameter name: index
06-27 14:43:48.247 I/MonoDroid(13254):   at System.Linq.Enumerable.ElementAt[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Int32 index) [0x0007b] in <1ea41f79845a40618089713a1d9403c4>:0 
06-27 14:43:48.247 I/MonoDroid(13254):   at Com.Syncfusion.Autocomplete.SfAutoComplete.PerformCompletion (System.Int32 position, System.Int64 id) [0x001a3] in <9e2539381fed490cb639522ebce9405c>:0 
06-27 14:43:48.247 I/MonoDroid(13254):   at Com.Syncfusion.Autocomplete.SfAutoComplete.OnTouch (Android.Views.View v, Android.Views.MotionEvent e) [0x00240] in <9e2539381fed490cb639522ebce9405c>:0 
06-27 14:43:48.247 I/MonoDroid(13254):   at Android.Views.View+IOnTouchListenerInvoker.n_OnTouch_Landroid_view_View_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_v, System.IntPtr native_e) [0x00017] in <1f978e077a40491b9118490f4344ce9f>:0 
06-27 14:43:48.247 I/MonoDroid(13254):   at (wrapper dynamic-method) System.Object.c1b1b100-2d48-422a-84eb-9cda81686f56(intptr,intptr,intptr,intptr)
06-27 14:43:48.668 D/Mono    (13254): Assembly Ref addref Mono.Android[0x78087e9300] -> System.Runtime.Serialization[0x77f842ec00]: 4

Is there a different way to accomplish the same thing (incremental search) without hitting this bug?

Thanks,
Jose


1 Reply

RK Rathana Kumar Sekar Syncfusion Team June 28, 2018 02:26 PM UTC

Hi Jose Simas,

Thanks for contacting Syncfusion Support.

We have checked the reported issue " System.ArgumentOutOfRangeException occur while use SfAutoComplete" and we were unable to reproduce the reported issue from our side. we have attached the sample for your reference. Please find the sample from the below link.

Sample: http://www.syncfusion.com/downloads/support/forum/138389/ze/Autocomplete-1938928420 

So, Could you please provide modified sample which replicates the reported issue.

It will help us to provide appropriate solution on this.

Regards,
Rathanakumar S. 


Loader.
Up arrow icon