Search code examples
c#twitterstack-overflowtweetsharp

Posting a tweet C#


I am trying to post a tweet with TweetSharp library but a StackOverflowException is thrown. I couldn't solve this problem. What should I do? The error occurs in this line:

servis.SendTweet(new SendTweetOptions { Status = textBox1.Text }); 

Solution

  • Break it down and step through in the debugger (put a break-point on the string status = ... line):

    // if you don't get this far, the problem is elsewhere
    
    // if it fails here, the problem is accessing the textbox value
    string status = textBox1.Text;
    
    // if it fails here, the problem is inside the tweetsharp library,
    // and should be referred to the library authors, but indicating which
    // step fails (constructor vs Status property vs Send method)
    var msg = new SendTweetOptions();
    msg.Status = status;
    servis.SendTweet(msg);