2010-10-05 69 views
1

民間,幫助調試一個stackoverflow - 重複堆棧的下一步?

我在我的.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] 
+0

我只是爲了在SO上發佈SO問題而從我那裏'+ 1'。 ':不是我可以幫助解決這個問題,但是看到這個問題我自己問自己在處理函數拋出時GC會發生什麼?) – sbi 2010-10-05 20:24:46

+0

WinDbg應該告訴你什麼線程引發了異常,所以你不會猜測哪一塊代碼是問題。 110仍然是一個相對較小的幀數沒有? – flatline 2010-10-05 20:35:39

+0

@Henk Holterman - 對不起,它的WinForms – SFun28 2010-10-05 20:55:37

回答

1

我(就)猜測,這是爲什麼不使用Application.DoEvents()一個很好的例子,但是你應該有一個什麼樣的代碼導致該至少有一些想法。

+0

原來我是通過UI線程異步封送許多UI更新(使用Form.BeginInvoke)。使ui更新的方法是調用Application.DoEvents()。我刪除了對DoEvents的調用,而是按照這裏的建議:http://blogs.msdn.com/b/jfoscoding/archive/2005/08/06/448560.aspx – SFun28 2010-10-07 13:51:17

4

它看起來像你的應用程序遞歸重新進入其UI消息循環。檢查你的窗口的事件處理程序,例如用於處理Resize事件時調整窗口大小等。

+0

這是一個很好的猜測。感謝您提到UI問題! – SFun28 2010-10-07 13:54:24