Fixing it here in the simplest way. Maybe not the best solution, but I'm not familiar with windows forms.
Through trial and error it seem like
_workerDispatcher = Dispatcher.CurrentDispatcher;Dispatcher.Run();
...must be set in _workerThread, otherwise the gui doesn't work or the program won't exit cleanly.
On faster machines we race to Invoke(SetupDevice); before _workerThread has instantiated the _workerDispatcher
easy way to solve is to just wait here until _workerDispatcher is set.
I see on discord that this is a common error. Maybe it's a scheduling thing on certain cpu's?
Exception it causes otherwise:
System.NullReferenceException: Object reference not set to an instance of an object.
at NK2Tray.SysTrayApp.ctor()
at NK2Tray.SysTrayApp.Main()
Ran into this after I upgraded my pc.
Fixing it here in the simplest way. Maybe not the best solution, but I'm not familiar with windows forms.
Through trial and error it seem like
_workerDispatcher = Dispatcher.CurrentDispatcher;
Dispatcher.Run();
...must be set in
_workerThread
, otherwise the gui doesn't work or the program won't exit cleanly. On faster machines we race toInvoke(SetupDevice);
before_workerThread
has instantiated the_workerDispatcher
easy way to solve is to just wait here until
_workerDispatcher
is set.I see on discord that this is a common error. Maybe it's a scheduling thing on certain cpu's? Exception it causes otherwise: