locked
List/ObservableCollection issue on windows 8.0

    Question

  • Hi,

    i seem to have a bug related to List/ObservableCollection as ItemsSource of a ListView.

    I have a universal app deployed on W8.0 and W8.1 and WP8.1 (Cover)

    My app basically displays lists of stuff (with a thumbnail acquired asynchronously for each item), then when i click an item i navigate on another page.

    In the list screens, i used to use ObservableCollection as ItemsSource for the ListView, but didn't need it because the list never evolves while the user is on it. So i decided to replace that by List, hoping to increase performance. This works very well on W8.1 and WP8.1, however it makes the W8.0 app very unstable. In fact, it makes it crash (the infamous "unhandled HRESULT E_FAIL in a COM Component" stuff) when something in the app (even if not related to the list) tries to do some awaitable stuff. But not always, it seems just random. Maybe it has to do with the disposing of the list because it mostly happens when navigating on other pages.

    For instance, I browse through list screens, my thumbnails display fine, then i click on an item, it navigates to another page where it tries to load the first page of the comic book. And the first awaitable call in this page will throw an error (here it's just some code to get the thumbnail during the loading. If i comment it out, it will be the next awaitable call (opening the comic book file to parse it) that will fail.

    Sometimes, it's also just browsing through several list pages that will make the app crash. The error is always the same, but it can happen on any await call.

    This only occurs on W8.0. Not on 8.1 or WP8.1 !

    When replacing back the List by ObservableCollection, it works on all platforms.

    Maybe i've missed something regarding List/ObservableCollection, but it seems like a bug to me. I hope the description is accurate enough, let me know if it's not.

    Thanks



    Friday, March 06, 2015 11:18 AM

Answers

  • Hi schouffy,

    List will not update client(UI) when any item added, removed from the list. you need to modify the underlying controls or rebind the datasource(like in ASP.NET). But observable collection will notify the UI(client) when any item gets added or removed and changed(implementing InotifypropertyChanged interface for the properties inside the list). Please use observable collection for the listview as a item source which will resolve all these types of problem. ObservableCollection is meant for that which implements InotifyCollectionChanged interface.


    Purushothama V S

    Sunday, March 08, 2015 6:19 PM

All replies

  • Post a repro project link.  There's not enough info here.  I doubt it's a list collection issue.

    Darin R.

    Friday, March 06, 2015 2:28 PM
  • Hi schouffy,

    List will not update client(UI) when any item added, removed from the list. you need to modify the underlying controls or rebind the datasource(like in ASP.NET). But observable collection will notify the UI(client) when any item gets added or removed and changed(implementing InotifypropertyChanged interface for the properties inside the list). Please use observable collection for the listview as a item source which will resolve all these types of problem. ObservableCollection is meant for that which implements InotifyCollectionChanged interface.


    Purushothama V S

    Sunday, March 08, 2015 6:19 PM