OllieDay / Lifx

Library for controlling LIFX Wi-Fi Smart LED devices
BSD 3-Clause "New" or "Revised" License
6 stars 4 forks source link

InvalidCastException In Communicator #2

Open OriNachum opened 5 years ago

OriNachum commented 5 years ago

I got an exception today when trying to get GetStateAsync. I asses this happend due line 75 in Communicator. Will take further review later on.

Relevant part of stacktrace: System.InvalidCastException: Unable to cast object of type 'Lifx.Communication.Responses.Payloads.ResponsePayload' to type 'Lifx.Communication.Responses.Payloads.StateResponsePayload'. at Lifx.Communication.Communicator.CommunicateAsync[TResponsePayload](Request request, CancellationToken cancellationToken) at Lifx.Light.GetStateAsync(CancellationToken cancellationToken)

OllieDay commented 5 years ago

Did this only occur once or are you able to reproduce it?

OriNachum commented 5 years ago

Will try and reproduce. Also having trouble using OnAsync/OffAsync/SetPower with duration and investigating this. I don't mind closing and re-open if I encounter it again

OriNachum commented 5 years ago

I'm able to reproduce on debug. Maybe it's .net core issue? I suspect it's an issue with multiple requests and async-await issue. I'm able to reproduce intermiteddly (I scan my network for lights, and then send a on/off request to one of them) Also, I put debug on Request.GetData return line (190)

OllieDay commented 5 years ago

I wasn't able to reproduce this exception using a .NET Core console application. I've opened issue #3 for the duration parameter not working.