Skip to main content
edited tags
Link
Jeff Atwood
  • 960
  • 1
  • 12
  • 18
Source Link
Mark
  • 163
  • 4

SOAPI data fails on WP7

Im trying to simply get all of the recent questions using Windows Phone 7.

But I keep getting an ObjectDisposedException

My Code is not complicated:

public void BeginGetAllRecentQuestions()
    {
        _context.Options.LazyLoadingEnabled(true);
        _context.Initialized += ContextInitialised;
        _context.Initialize(true);
    }

private void ContextInitialised(object sender, EventArgs e)
    {
        QuestionsQuery questionsQuery = _context.Official.StackOverflow.Questions.PageSize(20);
        if (GotAllRecentQuestions != null)
            GotAllRecentQuestions(questionsQuery.Sort(QuestionSort.Creation).Order(SortOrder.Desc).ToList());
    }

private void QuestionsReceived(List<Question> questions)
    {
        Debug.WriteLine(questions.Count);
        this.RecentQuestions = questions;
    }

And thats it, but I keep getting the exception, with the stack trace:

at System.Threading.EventWaitHandle.Set() at Soapi.ApiContext.<>c__DisplayClass12.b__e(IAsyncResult a) at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassd.b__b(Object state2) at System.Threading.ThreadPool.WorkItem.doWork(Object o) at System.Threading.Timer.ring()

which means nothing to me...

any ideas?