Occasionall "Cryptography cannot be initialized before connecting to SmartFoxServer!" in SFSEvent.CONNECTION handler
Posted: 14 Oct 2019, 16:04
I have checked our logs and find out, that users are ocasionally getting
InvalidOperationException: Cryptography cannot be initialized before connecting to SmartFoxServer! exception iside SFSEvent.CONNECTION handler. I have checked the forum and it looks like, that this exception is thrown when caling InitCrypto() when IsConnected is set to false.
When i add additionall log, IsConnected property is set to true iside the handler.
What do you think it happened? How can we fix it?
I would only assume, that connection lost have been triggered before CONNECTION has been trigerred. Is it even possible? I thought that the handlers are called in serial manner based on the stacktrace:
InvalidOperationException: Cryptography cannot be initialized before connecting to SmartFoxServer! exception iside SFSEvent.CONNECTION handler. I have checked the forum and it looks like, that this exception is thrown when caling InitCrypto() when IsConnected is set to false.
When i add additionall log, IsConnected property is set to true iside the handler.
What do you think it happened? How can we fix it?
I would only assume, that connection lost have been triggered before CONNECTION has been trigerred. Is it even possible? I thought that the handlers are called in serial manner based on the stacktrace:
Code: Select all
Sfs2X.Util.CryptoInitializerV2..ctor (Sfs2X.SmartFox sfs) (at <9bfe5727c1e148feb52fa1397dabf0b5>:0)
Sfs2X.SmartFox.InitCrypto () (at <9bfe5727c1e148feb52fa1397dabf0b5>:0)
xxx.Client.ServerConnection.OnConnection (Sfs2X.Core.BaseEvent evt) (at <23c0a572b4f74be0ad98fd09011f4a9d>:0)
Sfs2X.Core.EventDispatcher.DispatchEvent (Sfs2X.Core.BaseEvent evt) (at <9bfe5727c1e148feb52fa1397dabf0b5>:0)
Rethrow as Exception: Error dispatching event connection: Cryptography cannot be initialized before connecting to SmartFoxServer! at Sfs2X.Util.CryptoInitializerV2..ctor (Sfs2X.SmartFox sfs) (at <9bfe5727c1e148feb52fa1397dabf0b5>:0)
Sfs2X.SmartFox.InitCrypto () (at <9bfe5727c1e148feb52fa1397dabf0b5>:0)
xxx.Client.ServerConnection.OnConnection (Sfs2X.Core.BaseEvent evt) (at <23c0a572b4f74be0ad98fd09011f4a9d>:0)
Sfs2X.Core.EventDispatcher.DispatchEvent (Sfs2X.Core.BaseEvent evt) (at <9bfe5727c1e148feb52fa1397dabf0b5>:0)
Sfs2X.Core.EventDispatcher.DispatchEvent (Sfs2X.Core.BaseEvent evt) (at <9bfe5727c1e148feb52fa1397dabf0b5>:0)
Sfs2X.SmartFox.ProcessEvents () (at <9bfe5727c1e148feb52fa1397dabf0b5>:0)
xxx.Client.ServerConnection.Update () (at <23c0a572b4f74be0ad98fd09011f4a9d>:0)