I am trying to get a simple console app to work. I am stumbling on the await. If i run without await, My PinAuthorization is working, I get the code from twitter, enter it but cannot send a tweet. With the await in front of these commands, I am getting "The await operator can only be used with an async" method.
var auth = new PinAuthorizer()
{
CredentialStore = new InMemoryCredentialStore
{
ConsumerKey = ConfigurationManager.AppSettings["consumerKey"],
ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"]
},
GoToTwitterAuthorization = pageLink => Process.Start(pageLink),
GetPin = () =>
{
return (string)Interaction.InputBox("Enter Pin", "Twitter", string.Empty, 10, 10);
}
};
await auth.AuthorizeAsync();
If I remove await, I can run it, but it just cascades from there:
using (var twitterCtx = new TwitterContext(auth))
{
twitterCtx.TweetAsync("Test from thread");
}
No exceptions are thrown...
I have tried putting this in its own thread, doesnt make any difference. I have tried stuff like
Task task = twitterCtx.TweetAsync("Test from thread");
task.Wait();
Nothing is working. the project is 4.5 vs2013. LinqToTwitterPlc.dll 3.1.2, LinqToTwitter.AspNet.dll 3.1.2