Bug 59650 - Removing Item from ObeservableCollection for ListView.ItemsSource throws exception on windows
Summary: Removing Item from ObeservableCollection for ListView.ItemsSource throws exce...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.4.0
Hardware: PC Windows
: Normal major
Target Milestone: ---
Assignee: Samantha Houts [MSFT]
URL:
: 60228 ()
Depends on:
Blocks:
 
Reported: 2017-09-21 15:02 UTC by Jitendra Jadav
Modified: 2018-01-08 15:40 UTC (History)
9 users (show)

Tags: listview, clear, ac
Is this bug a regression?: Yes
Last known good build:


Attachments
Remove Item from ObservableCollection (633.28 KB, application/x-zip-compressed)
2017-09-22 06:38 UTC, Jitendra Jadav
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jitendra Jadav 2017-09-21 15:02:46 UTC
Hi
I have took "2.4.0.275-pre3" Version of XAMARIN when I am Removing Item from ObeservableCollection it throw exception like this
"Specified argument was out of the range of valid values.Severity"

Same for Clear() also get exception.


More Info about Environment is :

Microsoft Visual Studio Community 2017 Preview (2)
Version 15.4.0 Preview 2.0
VisualStudio.15.Preview/15.4.0-pre.2.0+26906.1
Microsoft .NET Framework
Version 4.7.02046

Installed Version: Community

Visual Basic 2017   00369-60000-00001-AA128
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA128
Microsoft Visual C# 2017

Xamarin   4.7.0.934 (d68a92f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK   7.5.0.15 (HEAD/cf9532456)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   10.14.0.26 (416f778)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Comment 1 Paul DiPietro [MSFT] 2017-09-21 15:11:31 UTC
Could you please provide us with a minimized reproduction project?
Comment 2 Jitendra Jadav 2017-09-22 06:31:57 UTC
Hi @Paul,

Please find sample project of removing issue it is only happen in last records you have to run app and tap on row 1,2,3 will remove but last 4 which will give exception!


URL of Sample project is here.

https://jitendrajadav.visualstudio.com/_git/RemoveIssu
Comment 3 Jitendra Jadav 2017-09-22 06:38:26 UTC
Created attachment 24879 [details]
Remove Item from ObservableCollection

Please check the sample project of removing item from ObservableCollection
Comment 4 Jitendra Jadav 2017-09-22 06:54:29 UTC
It's Seems like UWP ListView causing problem more erro info:

   at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
   at Xamarin.Forms.ListView.NotifyRowTapped(Int32 groupIndex, Int32 inGroupIndex, Cell cell)
   at Xamarin.Forms.ListView.NotifyRowTapped(Int32 index, Cell cell)
   at Xamarin.Forms.Platform.UWP.ListViewRenderer.OnControlSelectionChanged(Object sender, SelectionChangedEventArgs e)
Comment 5 Jitendra Jadav 2017-09-22 07:33:24 UTC
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index
   at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
   at Xamarin.Forms.ListView.NotifyRowTapped(Int32 groupIndex, Int32 inGroupIndex, Cell cell)
   at Xamarin.Forms.ListView.NotifyRowTapped(Int32 index, Cell cell)
   at Xamarin.Forms.Platform.UWP.ListViewRenderer.OnControlSelectionChanged(Object sender, SelectionChangedEventArgs e)
   at Windows.UI.Xaml.Con
Comment 6 Paul DiPietro [MSFT] 2017-10-19 15:41:08 UTC
A newer issue also refers to the same bug, I believe.
Comment 7 Paul DiPietro [MSFT] 2017-10-19 15:41:22 UTC
*** Bug 60228 has been marked as a duplicate of this bug. ***
Comment 8 JKastner 2017-10-30 16:24:25 UTC
I have another scenario that seems very similar to this bug. Steps:
1. In a UWP project, Have a ListView with grouping.
2. Bind the ListView to an ObservableCollection
3. When running, select an item in the ListView.
4. Remove that item from the bound Collection.

At this point, an ArgumentOutOfRangeException is thrown.

Following the same steps without grouping will not produce the bug.
This bug exists only in Uwp, not and is not reproducible in Android.

I have a minimum case here
https://github.com/jkastner/ListViewGroupingBug

Found with version of xamarin.forms 2.4.0.18342
Comment 9 E.Z. Hart [MSFT] 2017-11-01 21:34:59 UTC
I believe this can also be reproduced with the UI Test for Bugzilla 31330.
Comment 10 Samantha Houts [MSFT] 2017-11-11 00:10:58 UTC
I can no longer reproduce this issue with the latest nightly build. It should be fixed in 2.5.1-pre1. Thank you!
Comment 11 JKastner 2017-11-13 18:24:51 UTC
Confirmed as not reproducible when I upgraded my test project to 2.5.0.75255-pre3 - thanks.
Comment 12 Matthew 2017-12-05 11:37:57 UTC
Happening on 2.5.0.91635 (stable) so I'm not sure how it was reported as not reproducible in pre3
Comment 13 Matthew 2017-12-05 11:39:02 UTC
Clarification, it still happens when removing the last item in the collection, so perhaps that's why it's been incorrectly deemed "fixed".
Comment 14 Paul DiPietro [MSFT] 2018-01-05 19:03:42 UTC
Please open a new issue on GitHub with an updated reproduction if you're experiencing a certain behavior, as the latest stable build appears to work correctly with the attached reproduction even when clicking the last item in the list.
Comment 15 Matthew 2018-01-08 11:00:32 UTC
Did you actually test it on Windows 8.1? It might be fixed on UWP, but it's definitely not on Windows 8.1.
Comment 16 Paul DiPietro [MSFT] 2018-01-08 15:38:48 UTC
8.1 is no longer supported.
Comment 17 Matthew 2018-01-08 15:40:48 UTC
I already had this argument on Github, you broke Windows 8.1 and then decided "well, we won't bother fixing that". If I did this to my customers I'd have no customers.