Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 11757 [details]
*** Overview ***
When a ListView is bound to a source that uses weak references for its event handlers, the ListView does not receive CollectionChanged events from the collection after GC occurs.
*** Steps to Reproduce ***
1. Run the attached repro project
*** Expected Results ***
The ListView should keep updating as more items are added to the collection.
*** Actual Results ***
When GC occurs (manually run after 5 items in the repro project) the ListView does not update with any new items added to the collection.
*** Environment Info ***
=== Xamarin Studio ===
Version 5.9.4 (build 5)
Installation UUID: 94ce5106-6a72-4691-b34e-cd5857b1db66
Mono 4.0.2 ((detached/c99aa0c)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400020005
=== Apple Developer Tools ===
Xcode 6.3.2 (7718)
=== Xamarin.iOS ===
Version: 188.8.131.52 (Business Edition)
Build date: 2015-06-20 10:58:19-0400
=== Xamarin.Android ===
Version: 184.108.40.206 (Business Edition)
Android SDK: /Users/jimmygarrido/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.1 (API level 16)
4.4 (API level 19)
5.0 (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
=== Xamarin Android Player ===
Version: Unknown version
Location: /Applications/Xamarin Android Player.app
=== Xamarin.Mac ===
Version: 220.127.116.11 (Business Edition)
=== Build Information ===
Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8
=== Operating System ===
Mac OS X 10.10.3
Darwin Jimmys-MacBook-Pro.local 14.3.0 Darwin Kernel Version 14.3.0
Mon Mar 23 11:59:05 PDT 2015
Can we get the importance bumped up a notch higher than "Minor", this is a super annoying bug. See also https://github.com/reactiveui/ReactiveUI/issues/806#issuecomment-104662513
Attempting to run this sample I get:
07-01 12:31:20.471 I/MonoDroid( 4508): UNHANDLED EXCEPTION:
07-01 12:31:20.477 I/MonoDroid( 4508): System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
07-01 12:31:20.477 I/MonoDroid( 4508): at System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource) [0x00000] in /Users/builder/data/lanes/1196/6f9ba0bd/source/mono/external/referencesource/mscorlib/system/throwhelper.cs:94
07-01 12:31:20.477 I/MonoDroid( 4508): at System.Collections.Generic.List.Enumerator<XamFormsListViewWeakProxy.WeakHandler>.MoveNextRare () <0x00077>
07-01 12:31:20.477 I/MonoDroid( 4508): at System.Collections.Generic.List.Enumerator<XamFormsListViewWeakProxy.WeakHandler>.MoveNext () <0x00163>
07-01 12:31:20.477 I/MonoDroid( 4508): at XamFormsListViewWeakProxy.MyList.AddMonkey () [0x00070] in C:\Users\me\Downloads\XamFormsListViewWeakProxy\XamFormsListViewWeakProxy-master\XamFormsListViewWeakProxy\XamFormsListViewWeakProxy\App.cs:87
07-01 12:31:20.477 I/MonoDroid( 4508): at Java.Lang.Thread.RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/1196/6f9ba0bd/source/monodroid/src/Mono.Android/src/Java.Lang/Thread.cs:36
07-01 12:31:20.477 I/MonoDroid( 4508): at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) [0x00009] in /Users/builder/data/lanes/1196/6f9ba0bd/source/monodroid/src/Mono.Android/platforms/android-22/src/generated/Java.Lang.IRunnable.cs:71
07-01 12:31:20.477 I/MonoDroid( 4508): at (wrapper dynamic-method) System.Object.9e88fbd5-1093-497f-a059-c0a8920f971f (intptr,intptr) <IL 0x00011, 0x00043>
It looks like the original sample was modified a little bit
Here is what I created originally to demonstrate the problem
a .ToList() was removed from the foreach loop there...
So if you make line 87
foreach (var handler in eventHandlers.ToList())
that should fix the exception
I added WINRT to the sample ... Here's a link to the project in one drive
The issue happens a bit faster in WINRT
Updated samples are provided in comment #4 and comment #5 hence marking this as NEW again.
Hey Hey... Actually (AFAIK) this isn't related to the other issue I emailed you about... This bug is present on all platforms not just windows and has to do with the weak event handler getting GC'd
the sample for this one includes an android and WINRT version.... Whereas the other issue I'd emailed you about is a specific issue with WINRT and the LISTVIEW control when grouped
Reported mid-2015, status "NEW". _sigh_
Sorry this apparently never got transferred to the right tracking system.
Any ETA on this? thanks.
Any plans on solving this?
I'm having this same issue with the last versions of Xamarin, Xamarin.Froms and ReactiveUI.
I created a sample based on my current project: https://github.com/GiusepeCasagrande/XamarinFormsBug31415Sample
If you run on Android all goes well, all the cells are rendered perfectly.
On iOS it won't show the cells unless I rotate the device and force to redraw.
I also just encountered the same behaviour using ReactiveUI. The ListView did only get poplulated after the second time it was displayed.
Should be fixed in 2.3.5-pre1. Thank you!