调试游戏时的OutofMemory异常

时间:2014-02-03 15:30:55

标签: c# xna xna-4.0

到目前为止,我在XNA中成功创建了一个游戏,当我尝试调试时遇到了以下错误

spriteBatch = new SpriteBatch(GraphicsDevice);

从输出中收到的错误是

'Duality.exe' (CLR v4.0.30319: Duality.exe): Loaded  'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll' Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
A first chance exception of type 'System.OutOfMemoryException' occurred in Microsoft.Xna.Framework.Graphics.dll

Unhandled Exception: OutOfMemoryException.

这里还有对SpriteBatch的任何引用。它们位于文件的不同部分,而不是全部位于同一区域

//Outside of all Methods
SpriteBatch spriteBatch;
//In Draw Method
spriteBatch.Begin();
        /*spriteBatch.Draw(cursorTex, cursorPos, Color.White);*/
        spriteBatch.End();
        base.Draw(gameTime);
 spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
 base.Draw(gameTime);
        //The updating the mouse state
        cursorPos = new Vector2(mouseState.X, mouseState.Y);
        cursorPos = new Vector2();
        spriteBatch.End();

0 个答案:

没有答案