Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] InvalidOperationException: [Input] Invalid GamePad configuration value #1559

Open
YoshiRulz opened this issue Jan 28, 2023 · 6 comments
Milestone

Comments

@YoshiRulz
Copy link

YoshiRulz commented Jan 28, 2023

Description

Calling GamePad.GetState on app startup while a certain model of gamepad is plugged in causes it to crash.

Repro steps

Clone repro project, dotnet build && mono bin/Debug/OTKRepro.exe.

Expected behavior

Doesn't throw, and GamePad.GetState(0).IsConnected is true

Actual behavior

System.InvalidOperationException: [Input] Invalid GamePad configuration value
  at OpenTK.Input.GamePadConfiguration.ParseSource (System.String item) [0x00056] in <9314f5d039f340638e3a78d50aa1a6d0>:0 
  at OpenTK.Input.GamePadConfiguration.ParseConfiguration (System.String configuration) [0x00062] in <9314f5d039f340638e3a78d50aa1a6d0>:0 
  at OpenTK.Input.GamePadConfiguration..ctor (System.String configuration) [0x00011] in <9314f5d039f340638e3a78d50aa1a6d0>:0 
  at OpenTK.Platform.MappedGamePadDriver.GetConfiguration (System.Guid guid) [0x0001b] in <9314f5d039f340638e3a78d50aa1a6d0>:0 
  at OpenTK.Platform.MappedGamePadDriver.GetState (System.Int32 index) [0x00038] in <9314f5d039f340638e3a78d50aa1a6d0>:0 
  at OpenTK.Input.GamePad.GetState (System.Int32 index) [0x00000] in <9314f5d039f340638e3a78d50aa1a6d0>:0 
  at Program.<<Main>$>g__InitGamepads|0_0 () [0x00005] in <606ba0ca36e847498b15c85bd8e5ded1>:0 
  at Program.<Main>$ (System.String[] args) [0x00008] in <606ba0ca36e847498b15c85bd8e5ded1>:0

Related information

Crashes on Debian 11, Mono 6.12.0.182. Hardware is an iNext 'GAME CONTROLLER' 0079-0011 (SNES "dogbone" gamepad clone).

Repro project targets .NET Framework 4.8 and uses OpenTK 3.3.3 from NuGet. Only the Input types are used.

@shaoyidi
Copy link

I'm using Windows 10 with Opentk version 3.3.3 and Opentk.GLControl version 3.3.3 in a .NET Framework 4.7.2 WPF project. Debugging and releasing in Visual Studio both work fine, but after packaging and installing, the program crashes with an error when run on a debugging computer.

Application: MyApplication.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException
at OpenTK.Graphics.OpenGL.GL..cctor()
at OpenTK.Graphics.OpenGL.GL.get_DrawingBuffer()
at OpenTK.GLControl.CreateGraphicsContext(Boolean)
at OpenTK.GLControl.OnHandleCreated(System.EventArgs)
at System.Windows.Forms.Control.WmCreate(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)

Exception Info: System.Reflection.TargetInvocationException
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
at System.Delegate.DynamicInvokeImpl(System.Object[])
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)

@NogginBops
Copy link
Member

@shaoyidi this seems like a separate issue to me. Could you open a separate issue for this?

@NogginBops
Copy link
Member

@YoshiRulz is it possible to get the GUID for the controller that causes the exception?

@YoshiRulz
Copy link
Author

Other than the USB vendor ID you mean? I probably could, just give me code that prints it.

@NogginBops
Copy link
Member

NogginBops commented Apr 12, 2023

Calling Joystick.GetGuid(int index) should give you the guid of the device you are calling GetState(int index) for.

@YoshiRulz
Copy link
Author

It is 03000000-7900-0000-1100-000010010000.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants