StreamDeckSharp
StreamDeckSharp copied to clipboard
Cached KeyImages cannot be stored
I created and stored a number of KeyImage
images to improve performance during switching screens. However, during using such images, I ran into an exception:
Type: System.ArgumentNullException
Message: Value cannot be null. (Parameter 'key')
Call stack: at System.Runtime.CompilerServices.ConditionalWeakTable`2.GetValue(TKey key, CreateValueCallback createValueCallback)
at StreamDeckSharp.Internals.CachedHidClient.SetKeyBitmap(Int32 keyId, KeyBitmap bitmapData)
at OpenMacroKeyboard.Drivers.StreamDeckV2.Driver.UpdateVisuals(List`1 buttons, List`1 encoders)
at OpenMacroKeyboard.BusinessLogic.Services.DriverRepository.MacroKeyboard.UpdateKeyboardVisuals() in D:\Dokumenty\Dev\Pico\OpenMacroKeyboard\Desktop\OpenMacroKeyboard.BusinessLogic\Services\DriverRepository\MacroKeyboard.cs:line 48
at OpenMacroKeyboard.BusinessLogic.Services.DriverRepository.MacroKeyboard.SetActiveScreen(Screen newScreen) in D:\Dokumenty\Dev\Pico\OpenMacroKeyboard\Desktop\OpenMacroKeyboard.BusinessLogic\Services\DriverRepository\MacroKeyboard.cs:line 76
at OpenMacroKeyboard.BusinessLogic.Services.DriverRepository.MacroKeyboard.ExecuteMacro(BaseMacroInfo macro) in D:\Dokumenty\Dev\Pico\OpenMacroKeyboard\Desktop\OpenMacroKeyboard.BusinessLogic\Services\DriverRepository\MacroKeyboard.cs:line 104
at OpenMacroKeyboard.BusinessLogic.Services.DriverRepository.MacroKeyboard.<>c__DisplayClass18_0.<OpenMacroKeyboard.API.V1.Drivers.IDriverHandler.HandleEvent>b__0() in D:\Dokumenty\Dev\Pico\OpenMacroKeyboard\Desktop\OpenMacroKeyboard.BusinessLogic\Services\DriverRepository\MacroKeyboard.cs:line 208
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
Workaround: Disable caching when creating Stream Deck device instance. Also. don't store KeyBitmap
s, create them every time they are needed.