Skip to content

[Wine][Ch.8] InvalidCastException on startup when registering key hooks #130

@drojf

Description

@drojf

I saw this error on the logs, likely due to lack of error checking in KeyHook.cs

InvalidCastException: Cannot cast from source type to destination type.
  at System.Diagnostics.ProcessModuleCollection.get_Item (Int32 index) [0x00000] in <filename unknown>:0 
  at System.Diagnostics.Process.get_MainModule () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:get_MainModule ()
  at Assets.Scripts.Core.KeyHook.SetHook (Assets.Scripts.Core.LowLevelKeyboardProc proc) [0x00000] in <filename unknown>:0 
  at Assets.Scripts.Core.KeyHook..ctor () [0x00000] in <filename unknown>:0 
  at Assets.Scripts.Core.GameSystem.Initialize () [0x00000] in <filename unknown>:0 
  at Assets.Scripts.Core.GameSystem.CheckInitialization () [0x00000] in <filename unknown>:0 
  at Assets.Scripts.Core.GameSystem.Update () [0x00000] in <filename unknown>:0 

Full Log: log.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions