年后第一问,.NET高手进来看
程序运行一段时间后,发生自动退出情况。错误如下:
异常:Object reference not set to an instance of an object.
方法:TranslateMessage
堆栈: at System.Windows.Forms.UnsafeNativeMethods.TranslateMessage(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
模块中对frmMain调用ShowDialog。请高手指点,是不是frmMain里有问题,还是Framework有问题?
PS:有的时候DispatchMessageA方法也会引发错误。