Unhandled exception of type

时间:2015-06-22 11:06:45

标签: c# visual-studio xna compiler-warnings

After my game has been running for a certain amount of time, the same Warning shows up and my game breaks. I am not sure why this is and I cannot find a solution for it.

The message that keeps popping up is as follows:

Microsoft Visual Studio Express 2013 for Windows Desktop

An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in System.Drawing.dll

Additional information: The operation completed successfully

I have an Object class that deals with all of the Objects displayed on screen (position, collisions etc) and the warning seems to be coming from this class. When the warning is displayed, one line in-particular is highlighted every time, that is:

public Obj(Vector2 pos)
    {
        position = pos;
    }

Any help resolving my problem will be appreciated

1 个答案:

答案 0 :(得分:0)

您在游戏的非托管组件中有例外。转到调试 - >例外并勾选Win32 Exceptions行中的“用户未处理”框。

这样,只要抛出Win32异常,您的调试器就会中断,如果加载了所需的符号,您将能够像往常一样调试代码。

此外,您可以使用Marshal.GetLastWin32Error方法获取最后一个Win32错误代码。有了这些信息,您应该能够准确地找出您的代码所投入的内容,以及如何解决它。