当前位置:编程学习 > C#/ASP.NET >>

C# WinForm程序运行一段时间会奔溃

程序在运行一段时间后会奔溃 
应用程序日志中记录的错误是
.NET Runtime 4.0 Error Reporting

以下是详细信息
Faulting application ***.exe, version 1.0.0.0, stamp 50090a76, 
faulting module gdiplus.dll, version 5.2.6002.22791, stamp 4f33e9a6, 
debug? 0, fault address 0x0001de16. 

程序中已添加了捕捉全局异常的函数,但未捕捉到此异常。高手路过指点下啦。。。
--------------------编程问答-------------------- 你运行的是什么程序? --------------------编程问答-------------------- 内存泄露,注意内存释放就可以了 --------------------编程问答-------------------- 你的捕捉全局异常代码贴出来看看吧! --------------------编程问答--------------------
引用 2 楼  的回复:
内存泄露,注意内存释放就可以了


对.NET内核了解不是很多,但我记得.NET 会自动回收内存的? --------------------编程问答--------------------
引用 1 楼  的回复:
你运行的是什么程序?

自己写的一个程序。 --------------------编程问答-------------------- 有路过的没,进来看下子咯!!!!!!!! --------------------编程问答-------------------- 你里面应该有对图像的处理,图像处理的时候GDI的值可能大于你Windows的最大可用值就崩潰掉了! --------------------编程问答-------------------- 从出错信息看,是GDI+报的,有可能如下的问题存在:

1、你是否使用第三方界面控件?
2、你是否在线程中频繁的修改和重绘界面? --------------------编程问答--------------------
引用 8 楼  的回复:
从出错信息看,是GDI+报的,有可能如下的问题存在:

1、你是否使用第三方界面控件?
2、你是否在线程中频繁的修改和重绘界面?


有使用SplitContainerEx控件,也会在程序中重绘界面。
但程序奔溃的之前,已有将近一小时未对程序进行操作。 --------------------编程问答-------------------- 终于捕捉到详细的异常了  
Application: SoftPhone800.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
   at System.Drawing.SafeNativeMethods+Gdip.GdipDrawLineI(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, Int32, Int32, Int32, Int32)
   at System.Drawing.Graphics.DrawLine(System.Drawing.Pen, Int32, Int32, Int32, Int32)
   at System.Windows.Forms.DataGridViewCell.PaintBorder(System.Drawing.Graphics, System.Drawing.Rectangle, System.Drawing.Rectangle, System.Windows.Forms.DataGridViewCellStyle, System.Windows.Forms.DataGridViewAdvancedBorderStyle)
   at System.Windows.Forms.DataGridViewTopLeftHeaderCell.PaintBorder(System.Drawing.Graphics, System.Drawing.Rectangle, System.Drawing.Rectangle, System.Windows.Forms.DataGridViewCellStyle, System.Windows.Forms.DataGridViewAdvancedBorderStyle)
   at System.Windows.Forms.DataGridViewTopLeftHeaderCell.PaintPrivate(System.Drawing.Graphics, System.Drawing.Rectangle, System.Drawing.Rectangle, Int32, System.Windows.Forms.DataGridViewElementStates, System.Object, System.String, System.Windows.Forms.DataGridViewCellStyle, System.Windows.Forms.DataGridViewAdvancedBorderStyle, System.Windows.Forms.DataGridViewPaintParts, Boolean, Boolean, Boolean)
   at System.Windows.Forms.DataGridViewTopLeftHeaderCell.Paint(System.Drawing.Graphics, System.Drawing.Rectangle, System.Drawing.Rectangle, Int32, System.Windows.Forms.DataGridViewElementStates, System.Object, System.Object, System.String, System.Windows.Forms.DataGridViewCellStyle, System.Windows.Forms.DataGridViewAdvancedBorderStyle, System.Windows.Forms.DataGridViewPaintParts)
   at System.Windows.Forms.DataGridViewCell.PaintWork(System.Drawing.Graphics, System.Drawing.Rectangle, System.Drawing.Rectangle, Int32, System.Windows.Forms.DataGridViewElementStates, System.Windows.Forms.DataGridViewCellStyle, System.Windows.Forms.DataGridViewAdvancedBorderStyle, System.Windows.Forms.DataGridViewPaintParts)
   at System.Windows.Forms.DataGridView.PaintTopLeftHeaderCell(System.Drawing.Graphics)
   at System.Windows.Forms.DataGridView.PaintGrid(System.Drawing.Graphics, System.Drawing.Rectangle, System.Drawing.Rectangle, Boolean, Boolean)
   at System.Windows.Forms.DataGridView.OnPaint(System.Windows.Forms.PaintEventArgs)
   at System.Windows.Forms.Control.PaintWithErrorHandling(System.Windows.Forms.PaintEventArgs, Int16)
   at System.Windows.Forms.Control.WmPaint(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.DataGridView.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageA(MSG ByRef)
   at System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
   at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
   at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
   at System.Windows.Forms.Application.Run(System.Windows.Forms.Form)
   at NetSoftPhone22.Program.Main(System.String[])
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,