.net 帮助调试stackoverflow-重复堆栈的后续步骤?

.net 帮助调试stackoverflow-重复堆栈的后续步骤?,.net,winforms,debugging,stack-overflow,windbg,.net,Winforms,Debugging,Stack Overflow,Windbg,各位 我的.net 4.0应用程序中出现堆栈溢出。使用WinDbg,我发现以下堆栈信息块在不同的内存地址下重复了110次,这让我相信这就是溢出的情况。问题是,所有这些似乎都不是我的代码!关于如何继续调试有什么建议吗 000000000008e630 000007fef22d10b4 [CustomGCFrame: 000000000008e630] 000000000008e5f8 000007fef22d10b4 [GCFrame: 000000000008e5f8] 0000000000

各位

我的.net 4.0应用程序中出现堆栈溢出。使用WinDbg,我发现以下堆栈信息块在不同的内存地址下重复了110次,这让我相信这就是溢出的情况。问题是,所有这些似乎都不是我的代码!关于如何继续调试有什么建议吗

000000000008e630 000007fef22d10b4 [CustomGCFrame: 000000000008e630] 
000000000008e5f8 000007fef22d10b4 [GCFrame: 000000000008e5f8] 
000000000008e588 000007fef22d10b4 [GCFrame: 000000000008e588] 
000000000008e958 000007fef22d10b4 [HelperMethodFrame_PROTECTOBJ: 000000000008e958] System.RuntimeMethodHandle._InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeType)
000000000008eaa0 000007fef138587f System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, Boolean)
000000000008ebe0 000007fef13d000f System.Delegate.DynamicInvokeImpl(System.Object[])
000000000008ec50 000007feeee16127 System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry)
000000000008ec90 000007feeee16004 System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(System.Object)
000000000008ed20 000007fef1393178 System.Threading.ExecutionContext.runTryCode(System.Object)
000000000008f448 000007fef22d10b4 [HelperMethodFrame_PROTECTOBJ: 000000000008f448] System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
000000000008f570 000007fef13817e1 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
000000000008f5d0 000007fef138172b System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
000000000008f620 000007feeee15f31 System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry)
000000000008f680 000007feeee15b97 System.Windows.Forms.Control.InvokeMarshaledCallbacks()
000000000008f700 000007feeedfb7da System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
000000000008f8b0 000007feeee09a0d System.Windows.Forms.Form.WndProc(System.Windows.Forms.Message ByRef)
000000000008f990 000007feeedfb34c System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
000000000008fa60 000007feef60ef10 DomainBoundILStubClass.IL_STUB_ReversePInvoke(Int64, Int32, Int64, Int64)
000000000008fd98 000007fef236cae7 [NDirectMethodFrameStandalone: 000000000008fd98] System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
000000000008fd60 000007feeee271a0 DomainBoundILStubClass.IL_STUB_PInvoke(MSG ByRef)
000000000008fe30 000007feeee151d0 System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
0000000000090070 000007feeee149d3 System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
00000000000901d0 000007feeee14361 System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
0000000000090948 000007fef22d10b4 [DebuggerU2MCatchHandlerFrame: 0000000000090948] 
0000000000090a30 000007fef22d10b4 [CustomGCFrame: 0000000000090a30] 

我只是猜测这是一个为什么不使用Application.DoEvents的好例子,但您至少应该知道是什么代码导致了这种情况。

我只是猜测这是一个为什么不使用Application.DoEvents的好例子,但您至少应该知道是什么代码导致了这种情况。

看起来您的应用程序正在递归地重新进入其UI消息循环。检查窗口的事件处理程序,例如,在处理调整大小事件时调整窗口大小。

看起来您的应用程序正在递归地重新进入其UI消息循环。检查窗口的事件处理程序,例如,在处理调整大小事件时调整窗口大小。

+1我发来的,只是为了在SO上发布SO问题:不是说我可以帮助解决这个问题,但是看到这一点,我在问自己当dispose函数抛出时GC会发生什么?WinDbg应该告诉您是哪个线程引发了异常,这样您就不会猜测是哪个代码块出了问题。110仍然是一个相对较小的帧数吗?@Henk Holterman-对不起,这是WinForms@flatline-正确,我被告知线程是OS线程Id:0x1510。如果我向堆栈的上方看,那么我最终会看到一些看起来像我的代码的东西!不知道我是怎么错过的。@Frédéric Hamidi,@Henk Holterman-你给了我一些很好的建议。我想我正朝着正确的方向前进。当我有机会探索更多的代码时,我会对每个答案作出回应。+1来自我,只是因为我在SO上发布了一个SO问题:不是说我可以帮助解决这个问题,但是看到这一点,我在问自己当dispose函数抛出时GC会发生什么?WinDbg应该告诉您是哪个线程引发了异常,这样您就不会猜测是哪个代码块出了问题。110仍然是一个相对较小的帧数吗?@Henk Holterman-对不起,这是WinForms@flatline-正确,我被告知线程是OS线程Id:0x1510。如果我向堆栈的上方看,那么我最终会看到一些看起来像我的代码的东西!不知道我是怎么错过的。@Frédéric Hamidi,@Henk Holterman-你给了我一些很好的建议。我想我正朝着正确的方向前进。当我有机会探索更多的代码时,我会对每个答案做出回应。事实证明,我使用Form.BeginInvoke通过ui线程异步封送了许多ui更新。进行ui更新的方法是调用Application.DoEvents。我删除了对DoEvents的调用,而是遵循了这里的建议:原来我使用Form.BeginInvoke通过ui线程异步封送了许多ui更新。进行ui更新的方法是调用Application.DoEvents。我取消了对DoEvents的呼叫,而是遵循这里的建议:这是一个很好的猜测。谢谢你让我参与到UI问题中来!这是一个很好的猜测。谢谢你让我参与到UI问题中来!