Getting Threading.Timeout out of range using Streamming

Feb 1, 2011 at 2:09 PM

Hi,

I'm trying to use Linq2Twitter to read streamming related to some keywores.

I follow the strictly the sample:

            if (auth != null && auth.IsAuthorized)
                ctx = new TwitterContext(auth);
            else
                MessageBox.Show("Authorization Error");

            int count = 0;

            var streaming =
                (from strm in ctx.UserStream
                 where strm.Type == UserStreamType.Site &&
                       strm.Follow == "15411837,16761255" // these are relatively low-volume accounts,
                 // so you may want to add more to see results.
                 // i.e. add your account ID and tweet to see results.
                 select strm)
                .StreamingCallback(strm =>
                {
                    Console.WriteLine(strm.Content + "\n");

                    if (count++ >= 10)
                    {
                        strm.CloseStream();
                    }
                })
                .SingleOrDefault();

But ExecuteTwitterStream throws the following message:

ArgumentOutOfRangeException was unhandled
Timeout can be only be set to 'System.Threading.Timeout.Infinite' or a value > 0.
Parameter name: value

Another problem:  I'm trying to use strm.Track , but it forces me to use Follow.

Thanks for your help.

Marcos

 

Coordinator
Feb 2, 2011 at 1:42 PM

Hi Marcos,

I'm a little busy right now, so it might take a while, but I'll take a look.

Joe

Feb 2, 2011 at 7:00 PM

Thanks, Joe,

Do your best, I'm really blocked.

Marcos

Feb 2, 2011 at 10:38 PM

Hi Joe,

I found the problem, it's in lines 633/634 (and I guess 577/578) of TwitterExecute.  It overrides the standart timeout with 0.

I commented the lines and everything it's ok.

Marcos

Coordinator
Feb 3, 2011 at 1:21 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Feb 3, 2011 at 1:22 AM

Marcos,

Glad you got it; and thanks a lot for the fix. :)

Joe