Deadlock occurring during get samples stream example


I am using the code shown below that I got from the LinqToTwitter online documentation, to get sample statuses (LinqToTwitter 3.0.2). It's deadlocking. After the await call the UI is completely unresponsive. What am I doing wrong?

async private void btnTest_Click(object sender, RoutedEventArgs e)
        TwitterContext twitterCtx = new TwitterContext(SharedState.Authorizer);

        /* Sample stream */
        Debug.WriteLine("\nStreamed Content: \n");
        int count = 0;

            (from strm in twitterCtx.Streaming
             where strm.Type == StreamingType.Sample
             select strm)
            .StartAsync(async strm =>
                Console.WriteLine(strm.Content + "\n");

                if (count++ >= 5)

        Debug.WriteLine("Sample streams retrieved.");
Closed Jun 16, 2014 at 1:57 AM by JoeMayo
Fixed and deployed in LINQ to Twitter v3.0.4.


JoeMayo wrote May 5, 2014 at 2:38 AM

I just checked in a change that should help avoid deadlocks. It's available in the downloadable source code.

roschler wrote May 5, 2014 at 5:04 AM

Thanks Joe. Is the change in the NuGet package yet?