"At least one of the arguments provided to the query was invalid." Error

May 16, 2014 at 10:05 PM
It seems that after trying numerous different ways to get back information on a tweet just recreated with PublishTweet(text), I keep getting the above error.
The basic code is:
var credentials = TwitterCredentials.CreateCredentials(sa.AccessToken, sa.AccessTokenSecret, s.PublicKey, s.PrivateKey);
ILoggedUser user = Tweetinvi.User.GetLoggedUser(credentials);
ITweet results = user.PublishTweet(txtTweet.Text);
Looking deeper into the stacktrace I see:
[ArgumentException: At least one of the arguments provided to the query was invalid.]
   Tweetinvi.Credentials.TwitterAccessor.ExecuteMultipartQuery(String query, HttpMethod method, IEnumerable`1 medias) +127
   Tweetinvi.Credentials.TwitterAccessor.ExecutePOSTMultipartQuery(String query, IEnumerable`1 medias, JsonConverter[] converters) +77
   Tweetinvi.Controllers.Tweet.TweetQueryExecutor.PublishTweet(ITweetDTO tweetToPublish) +141
   Tweetinvi.Controllers.Tweet.TweetController.PublishTweet(ITweet tweetToPublish) +167
   Tweetinvi.Logic.<>c__DisplayClass62.<PublishTweet>b__61() +69
   Tweetinvi.Logic.LoggedUser.StartLoggedUserOperation(Func`1 operation) +79
   Tweetinvi.Logic.LoggedUser.PublishTweet(ITweet tweet) +175
   Tweetinvi.Logic.LoggedUser.PublishTweet(String text) +90
   Admin_TestTweet.btnTweet_Clicked(Object sender, EventArgs e) in c:\Users\mikeg the\documents\over the top\controlpanel\V3\super-admin\Tests\Tweet.aspx.cs:228
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9615682
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
My goal here is examine results to get the unique ID of this tweet as well as to determine if it succeed in getting posted. In the examples above, yes, the post went through, it appears that it choked on trying to push values into the ITweet.

I can, however, get the tweets to go through without throwing any exceptions if I use the following (which doesn't give me back ANY information that is usable):
var credentials = TwitterCredentials.CreateCredentials(sa.AccessToken, sa.AccessTokenSecret, s.PublicKey, s.PrivateKey);
TwitterCredentials.ExecuteOperationWithCredentials(credentials, () => { Tweet.PublishTweet(txtTweet.Text); });
Any thoughts on why this is happening? I really like what I'm seeing so far but need to get to the bottom of this.
May 16, 2014 at 10:43 PM
Well, finally stumbled on another possible way to do this:
var credentials = TwitterCredentials.CreateCredentials(sa.AccessToken, sa.AccessTokenSecret, s.PublicKey, s.PrivateKey);
ILoggedUser user = Tweetinvi.User.GetLoggedUser(credentials);
ITweet tweet = Tweet.CreateTweet(txtTweet.Text);
tweet.Publish();
I can live with that but thought you should still know about the above error.

I did find out by pulling information out of the tweet object, if found that the Creator object was not fully populated. The only value that comes back appears to be the Id. Is this a future feature or should we just expect to have to go grab the user based on the ID here?

MJG
Coordinator
May 17, 2014 at 2:38 AM
Hi,

Thank you for reporting the problem. This is actually a bug.
I am already working on a fix.

Regards,
Linvi
May 19, 2014 at 1:27 AM
Thanks so much. I figured it was SUPPOSED to work that way.

Thanks for a great product. We are converting over from TweetSharp (and prior to that Twitterizer) and I've found that your seems to be the most current and well supported .Net library out there. One developer (me) was able to learn your "spin" on accessing objects and OAuth, swap it in for TweetSharp, test and roll out to production server all in the same day. Thanks for that!

Thanks so much
Coordinator
May 19, 2014 at 11:57 PM
That's quite impressive. I am very happy to hear that.
I am trying to make the API easy to use and it is always good to hear such code story :)

I hope you'll continue enjoying tweetinvi. The bug fix will be released with Tweetinvi 0.9.3.0.
Feel free to follow the project in the People section so that you know when the release is available.

Kind Regards,
Linvi