Page 1 of 1

room.PlayerList and user.PlayerId Exception Occur

Posted: 15 Jan 2016, 13:00
by Eser Telekom
room.PlayerList and user.PlayerId Exception Occur

This problem occur client side.
We are developed Card Game by Unity. When ROOM_JOIN is event fire, I am trying to GET room.PlayerList or user.PlayerId (Is it correct way ?). Sometimes exception Occur on Real Android Device.
Second question is OnPlayerList is update when USER_ENTER_ROOM,USER_EXIT_ROOM and USER_COUNT_CHANGE events fire ?

These are exception stacks.

ERROR 1: ArgumentException: Destination array cannot hold the requested elements!

System.Collections.Generic.Dictionary`2[System.Int32,Sfs2X.Entities.User].CopyToCheck (System.Array array, Int32 index)
at System.Collections.Generic.Dictionary`2+ValueCollection[System.Int32,Sfs2X.Entities.User].CopyTo (Sfs2X.Entities.User[] array, Int32 index)
at System.Collections.Generic.List`1[Sfs2X.Entities.User].AddCollection (ICollection`1 collection)
at System.Collections.Generic.List`1[Sfs2X.Entities.User]..ctor (IEnumerable`1 collection)
at Sfs2X.Entities.Managers.SFSUserManager.GetUserList ()
at Sfs2X.Entities.SFSRoom.get_PlayerList ()

ERROR 2: IndexOutOfRangeException: Array index is out of range.

(wrapper stelemref) object:stelemref (object,intptr,object)
at System.Collections.Generic.Dictionary`2[System.Int32,Sfs2X.Entities.User].Do_CopyTo[User,User] (Sfs2X.Entities.User[] array, Int32 index, System.Collections.Generic.Transform`1 transform)
at System.Collections.Generic.Dictionary`2+ValueCollection[System.Int32,Sfs2X.Entities.User].CopyTo (Sfs2X.Entities.User[] array, Int32 index)
at System.Collections.Generic.List`1[Sfs2X.Entities.User].AddCollection (ICollection`1 collection)
at System.Collections.Generic.List`1[Sfs2X.Entities.User]..ctor (IEnumerable`1 collection)
at Sfs2X.Entities.Managers.SFSUserManager.GetUserList ()
at Sfs2X.Entities.SFSRoom.get_PlayerList ()

ERROR 3 : NullReferenceException: Object reference not set to an instance of an object.
Sfs2X.Entities.SFSRoom.get_PlayerList ()

ERROR 4 : NullReferenceException: A null value was found where an object instance was required.
Sfs2X.Entities.SFSRoom.get_PlayerList ()

ERROR 5 : NullReferenceException: Object reference not set to an instance of an object
Sfs2X.Entities.SFSUser.GetPlayerId (Room room)Sfs2X.Entities.SFSUser.get_PlayerId ()

Error Platfrom : Android (I dont know other platforms)
Unity Version : 4.6.9
Smartfox Client Version : 1.5.7.0
Smartfox Server Version : 2.9.2

Re: room.PlayerList and user.PlayerId Exception Occur

Posted: 19 Jan 2016, 17:03
by Lapo
Thanks for reporting.
The first two may have to do with concurrency and we're looking into it.

ERROR 4,5,6 I am not sure what could cause it and what is the context exactly. They may depend on errors #1, and #2.

In any case we should be able to send you an update in the next days that you can test. Stay tuned.

Re: room.PlayerList and user.PlayerId Exception Occur

Posted: 22 Jan 2016, 11:02
by Bax
Please contact us by email at info (at) smartfoxserver (dot) com, so we can send you a pre-release version with the concurrency fix you can test.
Also reference this post, thanks.