尝试构建/调试monogame模板和windowsgl的示例代码时,OpenTK出界问题

时间:2013-12-18 17:51:22

标签: visual-studio monogame opentk

我正在尝试学习Monogame,但是每当我尝试运行模板时,我都会收到此错误:

An unhandled exception of type 'System.IndexOutOfRangeException' occurred in OpenTK.dll

Additional information: Index was outside the bounds of the array.

我按照本教程安装了Monogame 3.0.1和OpenTK 1.1:https://github.com/mono/MonoGame/wiki/Tutorials。我在Windows 8.1计算机上使用Visual Studio Express 2012。

以下是尝试运行WindowsGL模板的输出文件:

'GameName2.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'GameName2.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'GameName2.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'GameName2.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'GameName2.vshost.exe' (Managed (v4.0.30319)): 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.
'GameName2.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'GameName2.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'GameName2.vshost.exe' (Managed (v4.0.30319)): Loaded 'c:\users\matthew\documents\visual studio 2012\Projects\GameName2\GameName2\bin\WindowsGL\Debug\GameName2.vshost.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'GameName2.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 'vshost.NotifyLoad' (0x19c4) has exited with code 0 (0x0).
The thread '<No Name>' (0x1b0c) has exited with code 0 (0x0).
The thread '<No Name>' (0x1be8) has exited with code 0 (0x0).
The thread 'vshost.LoadReference' (0x984) has exited with code 0 (0x0).
'GameName2.vshost.exe' (Managed (v4.0.30319)): Loaded 'c:\users\matthew\documents\visual studio 2012\Projects\GameName2\GameName2\bin\WindowsGL\Debug\GameName2.exe', Symbols loaded.
'GameName2.vshost.exe' (Managed (v4.0.30319)): Loaded 'c:\users\matthew\documents\visual studio 2012\Projects\GameName2\GameName2\bin\WindowsGL\Debug\MonoGame.Framework.dll'
'GameName2.vshost.exe' (Managed (v4.0.30319)): Loaded 'c:\users\matthew\documents\visual studio 2012\Projects\GameName2\GameName2\bin\WindowsGL\Debug\OpenTK.dll'
An unhandled exception of type 'System.IndexOutOfRangeException' occurred in OpenTK.dll
Additional information: Index was outside the bounds of the array.
The thread '<No Name>' (0xfc0) has exited with code 0 (0x0).
The program '[3160] GameName2.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).

我还在有问题的计算机上创建了一个虚拟的64位Windows 7和一个32位的Windows 7机器,并且在opengl32.dll上遇到了类似的错误。但是,我的实际64位Windows 7框运行模板就好了。我的笔记本电脑出了什么问题?

我深入到了构建崩溃的地步。我得到了这个日志:

Call stack with external code
OpenTK.dll!OpenTK.Platform.Windows.WinRawKeyboard.GetRegistryKey(string name)
OpenTK.dll!OpenTK.Platform.Windows.WinRawKeyboard.RefreshDevices()
OpenTK.dll!OpenTK.Platform.Windows.WinRawKeyboard.WinRawKeyboard(System.IntPtr windowHandle)
OpenTK.dll!OpenTK.Platform.Windows.WinRawInput.CreateDrivers()
OpenTK.dll!OpenTK.Platform.Windows.WinInputBase.ProcessEvents()
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart()
[Native to Managed Transition]

再一次,此错误只能在单台计算机及其中使用的所有虚拟机上重现。

1 个答案:

答案 0 :(得分:1)

我通过这个蒸汽线程找到了修补dll形式的修复:http://steamcommunity.com/app/218820/discussions/1/864974467282016219/

我替换了项目文件夹和monogame文件夹中的dll,代码现在运行。问题在于启用触摸的系统上的“虚拟数字化仪”。 OpenTK不知道如何处理它,所以它崩溃了。这个修补程序可能会告诉OpenTK忽略它无法识别的设备。