NullReferenceException: A null value was found where an object instance was required.
Code: Select all
Rethrow as Exception: Error dispatching event objectMessage: A null value was found where an object instance was required.
Sfs2X.Core.EventDispatcher.DispatchEvent (Sfs2X.Core.BaseEvent evt)
KeyNotFoundException: The given key was not present in the dictionary.
Code: Select all
System.Collections.Generic.Dictionary`2[System.Object,System.Object].get_Item (System.Object key)
Rethrow as Exception: Error dispatching event extensionResponse: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary`2[System.Object,System.Object].get_Item (System.Object key)
Sfs2X.Core.EventDispatcher.DispatchEvent (Sfs2X.Core.BaseEvent evt)
In my implementation I do the following:
- SmartFox.ProcessEvents is called every frame on the SmartFox instance.
- In certain cases I close the connection by calling SmartFox.Disconnect from the CONNECTION, LOGIN_ERROR, or ROOM_JOIN_ERROR event handlers.
- I keep the SmartFox instance around after having disconnected and continue to call SmartFox.ProcessEvents on it until I want to establish a new connection. At that time I call SmartFox.RemoveAllEventListeners and then replace the SmartFox instance with a new one.
Assuming EventDispatcher.DispatchEvent is called from inside SmartFox.ProcessEvents I suspect that I'm doing something in the handlers that I shouldn't. Is it safe to call Disconnect and RemoveAllEventListeners from event handlers?