2010-11-01 20 views
0

你們遇到過類似的東西嗎? 異常類型:System.ComponentModel.Win32Exception 異常消息:操作成功完成。 異常堆棧跟蹤:.net應用程序中的圖形異常(C#)

------------------------ 
    at System.Drawing.BufferedGraphicsContext.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits) 
    at System.Drawing.BufferedGraphicsContext.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height) 
    at System.Drawing.BufferedGraphicsContext.AllocBuffer(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle) 
    at System.Drawing.BufferedGraphicsContext.AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle) 
    at System.Drawing.BufferedGraphicsContext.Allocate(IntPtr targetDC, Rectangle targetRectangle) 
    at System.Windows.Forms.Control.WmPaint(Message& m) 
    at System.Windows.Forms.Control.WndProc(Message& m) 
    at DevExpress.XtraEditors.Container.EditorContainer.WndProc(Message& m) 
    at DevExpress.XtraGrid.GridControl.WndProc(Message& m) 
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) 
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) 
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 

到處在存在一個圖形對象使用的應用程序,它被用於使用如此設置被啓用。

謝謝。

+2

你想做什麼?一些源代碼會很有用。 – 2010-11-01 09:18:42

+0

基本上它是一個大型的winforms應用程序,並且此錯誤在生產中不時出現。因爲這不能在測試中複製,所以我想知道是否有人遇到過這種情況,也許是什麼解決方案,或者如果你不知道它從哪裏跳出來,你將如何隔離這樣的事情。 – Elena 2010-11-01 09:48:30

+0

你對某些圖形使用後臺線程嗎?即畫或準備一些東西? – 2010-11-01 11:10:46

回答

0

我們有一些類似的問題。這聽起來像你的應用程序中有一些內存泄漏。我們也遇到了類似的問題,並且花了很長時間才找出需要解決的問題。

一般來說,我可以建議你檢查一下,當你隱藏並且不再使用它時,你的勝利表單組件的Dispose方法是否被調用。但爲了驗證你是否有內存泄漏以及在哪裏修復它們,你需要一個好的內存分析器。

至少在我們的情況下,它解決了這些win32異常。

編輯: 我剛剛看到,在您的情況下,處置已啓用,我仍建議您檢查每個電話!我們也認爲Dispose會被調用,但有時並非如此!