Error when trying to show list statuses on Windows Phone 8.1

Dec 13, 2014 at 6:34 PM
Hi,
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 =
                    await
                        (from list in twitterCtx.List
                            where list.Type == ListType.Statuses &&
                                  list.OwnerScreenName == username &&
                                  list.Count == count && list.Slug == e.Parameter.ToString()
                            select list)
                            .ToListAsync();

                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!
Coordinator
Dec 14, 2014 at 2:57 AM
Hi,

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:

http://linqtotwitter.codeplex.com/SourceControl/latest#New/Demos/Linq2TwitterDemos_WindowsPhone/StatusDemos/HomeTimelineDemo.xaml.cs

This demo is available in the downloadable source code.

@JoeMayo