eXpl0it3r / streamdeck-clockify

Clockify Action for the Elgato Stream Deck
MIT License
46 stars 8 forks source link

NullReferenceException in Clockify.ClockifyContext.SetApiKeyAsync #13

Closed mgruen17 closed 4 months ago

mgruen17 commented 1 year ago

I think I configured it correctly but it seems like the _workspaces field is NULL after confirming the API Key.

Log:

2023-05-04 15:49:56.8758|INFO|dev.duerrenberg|1|Plugin version: 1.6
2023-05-04 15:49:56.8758|INFO|dev.duerrenberg|1|Connecting to Stream Deck...
2023-05-04 15:49:56.9686|INFO|dev.duerrenberg|1|Connected to Stream Deck
2023-05-04 15:49:56.9712|INFO|dev.duerrenberg|1|GlobalSettingsManager initialized
2023-05-04 15:49:58.4024|INFO|dev.duerrenberg|8|API key successfully set
2023-05-04 15:49:58.4024|INFO|dev.duerrenberg|13|API key successfully set
2023-05-04 15:49:58.5353|FATAL|dev.duerrenberg|4|Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at Clockify.ClockifyContext.SetApiKeyAsync(String serverUrl, String apiKey) in /Users/runner/work/streamdeck-clockify/streamdeck-clockify/Clockify/ClockifyContext.cs:line 157
   at Clockify.ToggleAction.OnTick() in /Users/runner/work/streamdeck-clockify/streamdeck-clockify/Clockify/ToggleAction.cs:line 79
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object )
   at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()
2023-05-04 15:49:58.5353|FATAL|dev.duerrenberg|6|Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at Clockify.ClockifyContext.SetApiKeyAsync(String serverUrl, String apiKey) in /Users/runner/work/streamdeck-clockify/streamdeck-clockify/Clockify/ClockifyContext.cs:line 157
   at Clockify.ToggleAction.OnTick() in /Users/runner/work/streamdeck-clockify/streamdeck-clockify/Clockify/ToggleAction.cs:line 79
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object )
   at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()
eXpl0it3r commented 1 year ago

Can you give the in-development plugin version a try and see if it fixes the issue?
If you use projects with different clients, consider adding the client name under the advanced settings.

Uninstall the existing plugin first - you don't need to remove any buttons - then unzip the download and open the plugin in Stream Deck.

mgruen17 commented 1 year ago

New error:

2023-05-05 17:35:53.4293|DEBUG|dev.duerrenberg|1|Logger Initialized
2023-05-05 17:35:53.4490|INFO|dev.duerrenberg|1|Plugin [dev.duerrenberger] Loading - 1 Actions Found
2023-05-05 17:35:53.7919|DEBUG|dev.duerrenberg|1|Plugin Loaded: UUID: 21A7A7854AE1FEDE10509FFBFE2F66BE Device Info: Devices:
[Id: CF18A49CF35CDC02EAE1025F4D0E03B5 Type: StreamDeckClassic Size: Rows: 3 Columns: 5]
ApplicationInfo: Language: en Platform: mac Version: 6.1.0.18521
PluginInfo: Version: 1.6

2023-05-05 17:35:53.7929|INFO|dev.duerrenberg|1|Plugin version: 1.6
2023-05-05 17:35:53.7929|INFO|dev.duerrenberg|1|Connecting to Stream Deck...
2023-05-05 17:35:53.8986|INFO|dev.duerrenberg|1|Connected to Stream Deck
2023-05-05 17:35:53.9021|INFO|dev.duerrenberg|1|GlobalSettingsManager initialized
2023-05-05 17:35:53.9329|DEBUG|dev.duerrenberg|4|Creating ToggleAction...
2023-05-05 17:35:55.2789|INFO|dev.duerrenberg|4|Connection to Clockify successfully established
2023-05-05 17:35:56.1721|FATAL|dev.duerrenberg|10|Unhandled Exception: System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument )
   at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 , Func`2 , Boolean& )
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 , Func`2 )
   at Clockify.ClockifyContext.GetRunningTimerAsync() in /Users/runner/work/streamdeck-clockify/streamdeck-clockify/Clockify/ClockifyContext.cs:line 112
   at Clockify.ToggleAction.OnTick() in /Users/runner/work/streamdeck-clockify/streamdeck-clockify/Clockify/ToggleAction.cs:line 60
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object )
   at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()

Thank you for doing this!

eXpl0it3r commented 1 year ago

Thanks for giving it a try, I think, I've found the cause of this error, but also spotted some additional failure points, which I'm currently looking into. 🙂

eXpl0it3r commented 4 months ago

This should be fixed with some of the additional rewrites. Try the latest release and please report back if you run into issues again.