ObservableCollection.Remove method is throwing ArgumentOutofRange Exception for Xamarin.ios
The mentioned code is a part of the custom control that we have written. While removing the items from the collection view we are getting the System.ArgumentOutofRange Exception with message Index was out of range, Must be a non-negative and less than the size of collection on the iOS platform. The same code is working fine with the UWP and Android platform
_observableCollectionObj.Remove(data);
Once I am writing the above-mentioned line inside the Device.BeginInvocationOnMainThread block then everything is working fine.
I am not sure what is the reason behind this behavior and why is it working fine with Windows and Android