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

timzhu800 2012-07-27 11:41:46
程序在运行一段时间后会奔溃
应用程序日志中记录的错误是
.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.

程序中已添加了捕捉全局异常的函数,但未捕捉到此异常。高手路过指点下啦。。。
...全文
880 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
yigemingzi1024 2012-07-27
  • 打赏
  • 举报
回复
你的捕捉全局异常代码贴出来看看吧!
sundayzhao 2012-07-27
  • 打赏
  • 举报
回复
内存泄露,注意内存释放就可以了
一根葱的无奈 2012-07-27
  • 打赏
  • 举报
回复
你运行的是什么程序?
timzhu800 2012-07-27
  • 打赏
  • 举报
回复
终于捕捉到详细的异常了
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[])
timzhu800 2012-07-27
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 的回复:]

从出错信息看,是GDI+报的,有可能如下的问题存在:

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

有使用SplitContainerEx控件,也会在程序中重绘界面。
但程序奔溃的之前,已有将近一小时未对程序进行操作。
isjoe 2012-07-27
  • 打赏
  • 举报
回复
从出错信息看,是GDI+报的,有可能如下的问题存在:

1、你是否使用第三方界面控件?
2、你是否在线程中频繁的修改和重绘界面?
THQWS 2012-07-27
  • 打赏
  • 举报
回复
你里面应该有对图像的处理,图像处理的时候GDI的值可能大于你Windows的最大可用值就崩潰掉了!
timzhu800 2012-07-27
  • 打赏
  • 举报
回复
有路过的没,进来看下子咯!!!!!!!!
timzhu800 2012-07-27
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]

你运行的是什么程序?
[/Quote]
自己写的一个程序。
timzhu800 2012-07-27
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 的回复:]

内存泄露,注意内存释放就可以了
[/Quote]

对.NET内核了解不是很多,但我记得.NET 会自动回收内存的?

111,125

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧