HI ,Tweetinvi team.
I'm get an error "NullReferenceException : Object reference not set in an instance of an object " when I publish a tweet.
Normally, I used to publish a tweet via this code many time. However, after OCT 2014 this code is not working.
```
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using TweetinCore.Interfaces.TwitterToken;
using Tweetinvi;
using TwitterToken;
namespace ONEtwitter
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public void sendtwitter()
{
string apikey = "oVIVYwxIboKIyVOM4SxNHrDlZ";
string apisecret = "dVosesBWGW8Zd47iZ2U99Ii9dzwmDDwulFmfj1M2lE7nzZvm8M";
string tokenkey = "2881681536-SIuhmCSDewwNdZKbYRDq0tMV33UH6TgI35bjVaY";
string tokensecret = "ZCkAsF4bLHPOmX5NVI6qe8jSVswLkvhCEjwjXgjUGXcCH";
string message = TB1.Text; // textbox1 for storing tweet message
try
{
IToken tokenZ = new Token(apikey, apisecret, tokenkey, tokensecret);
Tweet tw = new Tweet(message);
tw.Publish(tokenZ);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void BT1_Click(object sender, EventArgs e) // when click send button
{
sendtwitter();
}
}
}
```
i check in output box and saw an error code : 215 from twitter.
{"errors":[{"message":"Bad Authentication data","code":215}]}
> POST : https://api.twitter.com/1.1/statuses/update.json?status=test%20from%20application%20%40cses01&trim_user=False
Header OAuth oauth_consumer_key="2881681536-SIuhmCSDewwNdZKbYRDq0tMV33UH6TgI35bjVaY",oauth_nonce="7954648",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1414835245",oauth_token="oVIVYwxIboKIyVOM4SxNHrDlZ",oauth_version="1.0",oauth_signature="aofsTKlZ5CNV%2Bc6zHKsPXAz5ACs%3D"
A first chance exception of type 'System.NullReferenceException' occurred in Tweetinvi.dll
The program '[4248] ONEtwitter.vshost.exe: Managed (v4.0.30319)' has exited with code -1 (0xffffffff).
i don't sure this problem occour from "NullReference" or "Bad Authentication data" .
could you help me check this problem ?
i use tweetinvi version 0.8.x . May I use the new version for solve this problem or not ?
**** Note : for your information , i did't post the same tweet that may be the cause of error "NullReferenceException".
thank you.
I'm get an error "NullReferenceException : Object reference not set in an instance of an object " when I publish a tweet.
Normally, I used to publish a tweet via this code many time. However, after OCT 2014 this code is not working.
```
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using TweetinCore.Interfaces.TwitterToken;
using Tweetinvi;
using TwitterToken;
namespace ONEtwitter
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public void sendtwitter()
{
string apikey = "oVIVYwxIboKIyVOM4SxNHrDlZ";
string apisecret = "dVosesBWGW8Zd47iZ2U99Ii9dzwmDDwulFmfj1M2lE7nzZvm8M";
string tokenkey = "2881681536-SIuhmCSDewwNdZKbYRDq0tMV33UH6TgI35bjVaY";
string tokensecret = "ZCkAsF4bLHPOmX5NVI6qe8jSVswLkvhCEjwjXgjUGXcCH";
string message = TB1.Text; // textbox1 for storing tweet message
try
{
IToken tokenZ = new Token(apikey, apisecret, tokenkey, tokensecret);
Tweet tw = new Tweet(message);
tw.Publish(tokenZ);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void BT1_Click(object sender, EventArgs e) // when click send button
{
sendtwitter();
}
}
}
```
i check in output box and saw an error code : 215 from twitter.
{"errors":[{"message":"Bad Authentication data","code":215}]}
> POST : https://api.twitter.com/1.1/statuses/update.json?status=test%20from%20application%20%40cses01&trim_user=False
Header OAuth oauth_consumer_key="2881681536-SIuhmCSDewwNdZKbYRDq0tMV33UH6TgI35bjVaY",oauth_nonce="7954648",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1414835245",oauth_token="oVIVYwxIboKIyVOM4SxNHrDlZ",oauth_version="1.0",oauth_signature="aofsTKlZ5CNV%2Bc6zHKsPXAz5ACs%3D"
A first chance exception of type 'System.NullReferenceException' occurred in Tweetinvi.dll
The program '[4248] ONEtwitter.vshost.exe: Managed (v4.0.30319)' has exited with code -1 (0xffffffff).
i don't sure this problem occour from "NullReference" or "Bad Authentication data" .
could you help me check this problem ?
i use tweetinvi version 0.8.x . May I use the new version for solve this problem or not ?
**** Note : for your information , i did't post the same tweet that may be the cause of error "NullReferenceException".
thank you.