nbulp's picture

Crash in OpenTK.Platform.Windows.WinRawKeyboard.GetRegistryKey

Project:The Open Toolkit library
Category:bug report

One of the input devices, on my computer, is simply called "VIRTUAL_DIGITIZER" (it would seem). The GetRegistryKey-function in WinRawKeyboard attempts to split that string, using "#" as the separator character. In this case, it will not split into the three strings that GetRegistryKey expects, which causes it to raise an IndexOutOfBoundsExecption, when accessing the non-existent second string.

The code looks like this:

            string[] split = name.Split('#');
            string id_01 = split[0];    // ACPI (Class code)
            string id_02 = split[1];    // PNP0303 (SubClass code)
            string id_03 = split[2];    // 3&13c0b0c5&0 (Protocol code)

So, my "VIRTUAL_DIGITIZER"-device does not contain a "subclass code" nor a "protocol code".

Raw exception info:

System.IndexOutOfRangeException was unhandled
  Message=Index was outside the bounds of the array.
       at OpenTK.Platform.Windows.WinRawKeyboard.GetRegistryKey(String name)
       at OpenTK.Platform.Windows.WinRawKeyboard.RefreshDevices()
       at OpenTK.Platform.Windows.WinRawKeyboard..ctor(IntPtr windowHandle)
       at OpenTK.Platform.Windows.WinRawInput.CreateDrivers()
       at OpenTK.Platform.Windows.WinInputBase.ProcessEvents()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

// Matko


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nbulp's picture


P.S.: Same issue with WinRawMouse (and possibly in other places).

nbulp's picture


Ah, just discovered that this bug is already in the process of being fixed, for Windows 8: http://www.opentk.com/node/3198

AndyKorth's picture


Hey nbulp,

That fix was commit a while ago, so if you'd like, you can let me know if it's working in this branch:

There's been a handful of other fixes, including other Window input fixes on that branch as well.

koto's picture



I also got this issue. It appeared when I run Windows 8 emulator. Turning off emulator made bug disappear.


the Fiddler's picture


Status:open» fixed

This is fixed upstream: https://github.com/thefiddler/opentk

the Fiddler's picture


Version:1.x-dev» 1.1-2014-01-02
Status:fixed» closed

Closing bugs fixed in OpenTK 1.1.

If this is still an issue please file a new bug report at https://github.com/opentk/opentk/issues

ludwig44's picture


Priority:normal» critical
Assigned to:Anonymous» ludwig44
Status:closed» open

This problem isn't fixed. I am running into the error in visual studio 2012. For some reason, whenever I create a new file and run it, it gives me this error and doesn't run openTK 1.1 but instead it's running a later version even though I only have openTK 1.1 installed. The only way I have found a fix for this error is to restart my computer everytime I want to run the program.

the Fiddler's picture


Version:1.1-2014-01-02» 1.1-dev
Status:open» fixed

Oh, you are right.

This is fixed in commit 1b3b510, which will be included in the next release.

ludwig44's picture


Any estimated time on the update release? On another note my laptop is a touchscreen windows 8.1 and apparently those are the only ones affected with the openTK.Dll error.

the Fiddler's picture


Version:1.1-dev» 1.1.0-rc1
Status:fixed» closed

This fix is included in 1.1-rc1.