Forum Cross Platform with Xamarin

ListViews, ObservableCollections, and Threads! Oh my!


I'm trying to write a very small forms app. I have a listview, and a button that queries our server and updates the list. Because that update can take a few seconds, I have it spun off in a task, but it crashes with an "An item with the same key has already been added." exception. If I remove the Task.Run() call (putting the update code on the main thread), it runs just fine.

I'm using XAML and binding it to an observable list, which the function invoked in the task then changes. I'm guessing this is a bad idea. How should I be structuring this?


Best Answer


Sign In or Register to comment.