我有一个XNA应用程序,在某台笔记本电脑(戴尔,Win 7 64bit)上运行时会崩溃。
有时会在几分钟后崩溃,有时需要很多小时,但最终总是崩溃。
该应用程序是用VS2010 XNA4.0
我不得不添加到AppDomain.CurrentDomain.UnhandledException事件正好赶上这个例外,
这里是堆栈跟踪:XNA graphicsdevice.present在“值不在预期范围内”崩溃
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 - 您可以在这里找到关于如何执行此操作的信息:http://blogs.msdn.com/b/shawnhar/archive/2007/01/31/debugging -xna-graphics-problems.aspx – Dracorat