나는 여기서 무슨 일이 일어나고 있는지 잘 모르겠다. 트위터 API로 인증한다.왜이 StackOverflowException을 수신합니까?
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
내가 꽤 당황 해요 : 그것은 트위터에 게시해야하는 지점에 도달 할 때
는하지만, 그것은라는 StackOverflowException
발생합니다. 아래의 코드는 예외를 초래하고 궁극적으로 예외의 원인이되는 것입니다.
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*
}
사용중인 라이브러리는 TweetSharp입니다.
편집 : 추가 된 호출 스택 데이터
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
'SendTweet' 메서드 게시 –
Visual Studio에서 이것을 디버깅 할 수 있다면 * 호출 스택 * 창 (** Ctrl ** + ** C **, ** D **)을 열고 대답은 바로 거기 있어야합니다. 메소드'a()'를 (직접 또는 간접적으로 하나 이상의 다른 메소드를 통해) 다시 호출하는 메소드'b()'를 호출하는 메소드'a()'를 가지고있을 것이다. –
@ 리차드 에브 감사합니다! 나는 정직 할 것이다, 거기에서 많이 모을 수 없다. 당신은 그것에서 무엇이든을 얻을 수 있는가? – Frostytheswimmer