Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

Commented Unassigned: Exception in Sample Stream [2225]

$
0
0
I am trying to start a sample stream using the below code, but the stream shutdowns as soon as it starts. I created a handler for StreamStopped and got the following exception. Can you look at the code and tell me its something which I am missing or its a problem with the library?

```
System.ArgumentNullException: Value cannot be null.
Parameter name: source
at AsyncExtensions.ReadLineAsync(TextReader source)
at Tweetinvi.Streams.Helpers.StreamResultGenerator.<StartStreamAsync>d__7.MoveNext()
```


```
TwitterCredentials.ApplicationCredentials = TwitterCredentials.CreateCredentials(ConfigurationManager.AppSettings["twitterAccessToken"], ConfigurationManager.AppSettings["twitterAccessTokenSecret"], ConfigurationManager.AppSettings["twitterConsumerKey"], ConfigurationManager.AppSettings["twitterConsumerSecret"]);

_sampleStream = Stream.CreateSampleStream();
_sampleStream.FilterTweetsToBeIn(Language.English);
_sampleStream.StreamStopped += (sender, args) =>
{
};
_sampleStream.TweetReceived += (sender, args) =>
{
if (args.Tweet.Text != null)
{
_tweetsCollection.Enqueue(args.Tweet);
}
};
_sampleStream.StartStream();
```
Comments: ** Comment from web user: mohibsheth **

If you look at my original code, I was setting the credentials.. but setting TwitterCredentials.ApplicationCredentails, didnt seem to work. Since my app is multi-threaded, I was trying to set ApplicationCredentials. as its instructed in the Getting Started. Since that didnt work, I set the credentials using the SetCredentials method and that worked. Why did the ApplicationCredentials property not work?


Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>