Ich bin mir nicht sicher, was hier vor sich geht, es authentifiziert sich mit der Twitter-API ganz gut.Warum erhalte ich diese StackOverflowException?
Aber wenn es auf den Punkt, wo es sollte twittern posten, wirft es ein StackOverflowException
, der sagt:
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
ich ziemlich verwirrt bin. Der folgende Code führt zu der Ausnahme und verursacht diese.
void StartValidation()
{
Console.Clear();
//Start Status thread
var status = TextAndUi.GetStatisThread();
status.Start("Validating");
//Check for Messages
var tweetAndSenderData = Imap.GetUnreadMessageAndSender();
if (tweetAndSenderData != null)
{
//Authurize connection and app
var authenticate = new Authenticate();
var tweetApp = authenticate.CreateClient();
//End thread
status.Abort();
Console.WriteLine("Validated!");
Console.Clear();
//Post tweets
PostContent("test", tweetApp);
//Delete messages
Imap.DeleteMessages();
}
else
{
//End thread
status.Abort();
TextAndUi.ShowSomethingToTheUser("The box is empty, or TTT could not secure a connection", true);
}
}
void PostContent(string myTweet, TwitterService tweetApp)
{
if (TextAndUi.MessageIsSuitableLength(myTweet))
{
PostTweet(tweetApp, myTweet);
}
}
void PostTweet(TwitterService tweetApp, string tweet)
{
var tweetOptions = new SendTweetOptions() {Status = tweet};
tweetApp.SendTweet(tweetOptions); /*The line that throws the exception*
}
Die verwendete Bibliothek ist TweetSharp.
Edit: Added Callstack Daten
mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x6b bytes Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x27 bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x6f bytes mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes
Beitrag 'SendTweet' Methode –
Wenn Sie in der Lage sind, diese in Visual Studio zu debuggen, öffnen Sie die * Rufen Sie Stapel * Fenster (** Strg + ** ** C **, ** D **) und Sie die Antwort sollte genau dort sein. Sie haben wahrscheinlich die Methode 'a()' Aufrufmethode 'b()', die die Methode 'a()' erneut aufruft (entweder direkt oder indirekt über eine oder mehrere andere Methoden). –
@RichardEv Danke dafür! Ich werde ehrlich sein, es gibt nicht viel _I_ kann davon sammeln. Kannst du etwas daraus machen? – Frostytheswimmer