This project has moved. For the latest updates, please go here.

Error when trying to show list statuses on Windows Phone 8.1

Dec 13, 2014 at 6:34 PM
I'm developing a Windows Phone 8.1 app and when I try to show a list statuses, I get this error: "The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))"

This is my code:
var listResponse =
                        (from list in twitterCtx.List
                            where list.Type == ListType.Statuses &&
                                  list.OwnerScreenName == username &&
                                  list.Count == count && list.Slug == e.Parameter.ToString()
                            select list)

                if (listResponse != null && listResponse.FirstOrDefault().Statuses != null)
                    List.ItemsSource = listresponse;
I get the same error when searching for users. I also tried to insert a dispatcher but I got the same error.

Thank you!
Dec 14, 2014 at 2:57 AM

It sounds like your assumption about needing to marshal the call onto the UI thread would be correct. I'm not sure why that didn't work for you. I took a different approach with updating an ObservableCollection in a ViewModel:

This demo is available in the downloadable source code.