0

現在、ボタンのクリックで新しいウィンドウを開く Windows フォーム アプリケーションを使用しています。2 番目のウィンドウを閉じると、断続的に次の例外が発生し、アプリケーションがクラッシュします。

アプリケーション: Manager.exe フレームワーク バージョン: v4.0.30319 説明: 未処理の例外が発生したため、プロセスが終了しました。例外情報: System.AccessViolationException スタック: System.Drawing.SafeNativeMethods+Gdip.GdipDrawImageRectRectI(System.Runtime.InteropServices.HandleRef、System.Runtime.InteropServices.HandleRef、Int32、Int32、Int32、Int32、Int32、Int32、Int32、Int32 で、Int32、System.Runtime.InteropServices.HandleRef、DrawImageAbort、System.Runtime.InteropServices.HandleRef) で System.Drawing.Graphics.DrawImage (System.Drawing.Image、System.Drawing.Rectangle、Int32、Int32、Int32、Int32、 System.Drawing.GraphicsUnit、System.Drawing.Imaging.ImageAttributes、DrawImageAbort、IntPtr) で System.Drawing.Graphics.DrawImage(System.Drawing.Image、System.Drawing.Rectangle、Int32、Int32、Int32、Int32、System.
System.Windows.Forms.ControlPaint.DrawBackgroundImage (System.Drawing.Graphics、System.Drawing.Image、System.Drawing.Color、System.Windows.Forms.ImageLayout、System.Drawing.Rectangle、System.Drawing.Rectangle、System で.Drawing.Point、System.Windows.Forms.RightToLeft) で System.Windows.Forms.Control.PaintBackground (System.Windows.Forms.PaintEventArgs、System.Drawing.Rectangle、System.Drawing.Color、System.Drawing.Point) System.Windows.Forms.Control.PaintBackground (System.Windows.Forms.PaintEventArgs、System.Drawing.Rectangle) で System.Windows.Forms.Control.OnPaintBackground (System.Windows.Forms.PaintEventArgs) で System.Windows.Forms .ScrollableControl.OnPaintBackground(System.Windows.Forms.PaintEventArgs) で System.Windows.Forms.Control.PaintWithErrorHandling(System.Windows.Forms.PaintEventArgs,Int16) で System.Windows.Forms.Control.WmEraseBkgnd (System.Windows.Forms.Message ByRef) で System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message ByRef) で System.Windows.Forms.ScrollableControl .WndProc(System.Windows.Forms.Message ByRef) で System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef) で System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows .Forms.Message ByRef) の System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr) の System.Windows.Forms.UnsafeNativeMethods.IntBeginPaint(System.Runtime.InteropServices.HandleRef, PAINTSTRUCT ByRef) の System. Windows.Forms.Control.WmPaint(System.Windows.Forms.Message ByRef) で System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef) で System.Windows.Forms.ScrollableControl.WndProc(System.Windows.Forms.Message ByRef) で System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef) で System.Windows. Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef) で System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr) で System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)IntPtr) System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW (MSG ByRef) でIntPtr) System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW (MSG ByRef) で
System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32) で System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms. ApplicationContext) で System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext) で System.Windows.Forms.Application.Run(System.Windows.Forms.Form) で Manager.Program.Main で()

通常、日中は問題なく開閉できますが、プログラムを一晩実行したままにし、朝に2番目のウィンドウを開こうとすると、ウィンドウを閉じようとするとこの例外が発生します。この例外は、最初にアプリケーションを実行し始めたときよりも頻繁にスローされます。

誰かがこの例外を見たことがありますか、それを修正する方法を知っていますか? 答えを見つけるためにオンラインで広範囲に検索しましたが、該当する答えを見つけることができませんでした。

4

0 に答える 0