【发布时间】:2011-11-18 19:39:19
【问题描述】:
我有一个 XNA 应用程序,在某台笔记本电脑(戴尔、Win 7 64 位)上运行时会崩溃。
有时几分钟后崩溃,有时需要几个小时,但最终总是崩溃。
该应用程序是用XNA4.0 VS2010编写的
我必须向 AppDomain.CurrentDomain.UnhandledException 添加一个事件才能捕获此异常,
这是堆栈跟踪:
System.ArgumentException: Value does not fall within the expected range.
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.Present(tagRECT* pSource, tagRECT* pDest, HWND__* hOverride)
at Microsoft.Xna.Framework.GraphicsDeviceManager.Microsoft.Xna.Framework.IGraphicsDeviceManager.EndDraw()
at Microsoft.Xna.Framework.Game.EndDraw()
at Microsoft.Xna.Framework.Game.DrawFrame()
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
at Microsoft.Xna.Framework.GameHost.OnIdle()
at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.Xna.Framework.WindowsGameHost.Run()
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Moof.Moof.Run()
at Moof.Program.Main(String[] args)
有什么想法吗?
谢谢。
【问题讨论】:
-
我认为您的视频设备失效了。如果是这种情况,它将在调试模式下显示 DirectX - 您可以在此处找到有关如何执行此操作的信息:blogs.msdn.com/b/shawnhar/archive/2007/01/31/…
标签: graphics error-handling xna