I know there is another post about this, but my problem is different because I’ve got exactly the same line of code as Sam in the video but I still get the invalid cast error.
It throws the error at this line:
Dictionary<string, object> data = (Dictionary<string, object>)state;
Why else could this be? It works fine in the video.