Bug 33053 - SortedSet<T> add items adapater problem android
Summary: SortedSet<T> add items adapater problem android
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 1.4.4
Hardware: Macintosh Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-08-13 09:38 UTC by Nicolas Hotterbeekx
Modified: 2016-04-13 18:53 UTC (History)
2 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:


Attachments
Reproduction Project (192.09 KB, application/zip)
2015-08-17 16:39 UTC, Paul DiPietro [MSFT]
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 Nicolas Hotterbeekx 2015-08-13 09:38:58 UTC
Hi,

Binding a xamarin.forms listview to a SortedSet<T> (https://msdn.microsoft.com/en-us/library/dd412070(v=vs.110).aspx) works as expected but when adding a new item to the collection after the binding, that application crashes.

This is the error:
08-13 06:56:50.660 D/AndroidRuntime( 5625): Shutting down VM
An unhandled exception occured.

08-13 06:56:54.078 E/AndroidRuntime( 5625): FATAL EXCEPTION: main
08-13 06:56:54.078 E/AndroidRuntime( 5625): Process: com.yourCompanyHere.interactivitylistview, PID: 5625
08-13 06:56:54.078 E/AndroidRuntime( 5625): java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. Make sure your adapter calls notifyDataSetChanged() when its content changes. [in ListView(-1, class android.widget.ListView) with Adapter(class android.widget.HeaderViewListAdapter)]
08-13 06:56:54.078 E/AndroidRuntime( 5625): 	at android.widget.ListView.layoutChildren(ListView.java:1562)
08-13 06:56:54.078 E/AndroidRuntime( 5625): 	at android.widget.AbsListView$CheckForTap.run(AbsListView.java:3281)
08-13 06:56:54.078 E/AndroidRuntime( 5625): 	at android.os.Handler.handleCallback(Handler.java:739)
08-13 06:56:54.078 E/AndroidRuntime( 5625): 	at android.os.Handler.dispatchMessage(Handler.java:95)
08-13 06:56:54.078 E/AndroidRuntime( 5625): 	at android.os.Looper.loop(Looper.java:135)
08-13 06:56:54.078 E/AndroidRuntime( 5625): 	at android.app.ActivityThread.main(ActivityThread.java:5254)
08-13 06:56:54.078 E/AndroidRuntime( 5625): 	at java.lang.reflect.Method.invoke(Native Method)
08-13 06:56:54.078 E/AndroidRuntime( 5625): 	at java.lang.reflect.Method.invoke(Method.java:372)
08-13 06:56:54.078 E/AndroidRuntime( 5625): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
08-13 06:56:54.078 E/AndroidRuntime( 5625): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Comment 1 Paul DiPietro [MSFT] 2015-08-17 16:38:43 UTC
I'm going to set this to confirmed for the time being and will upload a project; I can make a reproduction that does show a similar error after I've added an item and click on the ListView itself, but that doesn't occur under iOS. Doing a copy of SortedSet<string> (for instance) seems fine, but is obviously not optimal.
Comment 2 Paul DiPietro [MSFT] 2015-08-17 16:39:26 UTC
Created attachment 12540 [details]
Reproduction Project
Comment 3 Chris King 2016-04-13 18:53:56 UTC
Re-ran on latest build. Add button adds item and no crash is shown. 

Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.