Page 1 of 2
Error handling data: Argument cannot be null
Posted: 10 Mar 2014, 14:12
by alienwoods
Dear Support!
I use custom java server extension for SmartFox X2 v2.8.2. . I use it in a C# Unity project. The project works without any problem on Windows, but this happens only with IOS.
The problem is, the requested event which are sent by new ExtensionRequests() method, and processed by our java extension are sends coorrect infomation back to client, but on the client side the xCode log says:
Code: Select all
[SFS - DEBUG] Handling New Packet of size 186
[SFS - DEBUG] Handling Header Size. Length: 185 (small)
[SFS - DEBUG] Data size is 183
[SFS - DEBUG] Handling Data: 183, previous state: 0/183
[SFS - DEBUG] <<< Packet Complete >>>
[SFS - ERROR] Error handling data: Argument cannot be null.
Parameter name: TypeName at System.Type.GetType (System.String typeName) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.Sfs2Cs (ISFSObject sfsObj) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeSFSObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.Binary2Object (Sfs2X.Util.ByteArray data) [0x00000] in <filename unknown>:0
at Sfs2X.Entities.Data.SFSObject.NewFromBinaryData (Sfs2X.Util.ByteArray ba) [0x00000] in <filename unknown>:0
at Sfs2X.Core.SFSProtocolCodec.OnPacketRead (Sfs2X.Util.ByteArray packet) [0x00000] in <filename unknown>:0
at Sfs2X.Core.SFSIOHandler.HandlePacketData (Sfs2X.Util.ByteArray data) [0x00000] in <filename unknown>:0
And the answer data is not processed further from this point, just generates random errors at runtime.
How could we eliminate this null error? What could be missed?
Re: Error handling data: Argument cannot be null
Posted: 10 Mar 2014, 14:32
by Lapo
It looks like the iOS device received corrupt data.
Are you sending data to the client at a fast rate? Say 10+ messages/sec?
Is it TCP or UDP?
thanks
Re: Error handling data: Argument cannot be null
Posted: 10 Mar 2014, 14:54
by alienwoods
Well, its just TCP and this data call happens only once in the Unity Scene load's Start function
Re: Error handling data: Argument cannot be null
Posted: 10 Mar 2014, 15:01
by Lapo
Thanks. Is the problem intermittent? Or does it happen all the times?
Re: Error handling data: Argument cannot be null
Posted: 10 Mar 2014, 15:07
by alienwoods
Currently it's random. The SFS Server is located in the LAN network, and the iPad device is connects to the same network by Wifi. Since my first entry, it was good only 1/10 times of gamestarts.
Re: Error handling data: Argument cannot be null
Posted: 10 Mar 2014, 15:19
by Lapo
You are saying it fails 9 times out of 10?
Can you show me the server side code that sends the packet? I just want to see what kind of data you are sending.
It should be irrelevant, but I want to understand if we might be able to reproduce it.
It sounds like a problem posted here:
http://forums.smartfoxserver.com/viewto ... 20&p=72742
thanks
Re: Error handling data: Argument cannot be null
Posted: 11 Mar 2014, 08:24
by alienwoods
Files sent in PM for further investigaiton.
Re: Error handling data: Argument cannot be null
Posted: 11 Mar 2014, 10:06
by Lapo
Thanks for the material.
Can you please tell me exactly which lines in your code (and which file) is the message that causes the issue on the client side?
Re: Error handling data: Argument cannot be null
Posted: 11 Mar 2014, 10:19
by alienwoods
Sure,
From the unity proj, in NetworkConnector.cs there is RequestTiles() function, where we trigger a new ExtensionRequest with "qt" parameter.
This arrives into the extension, where we query the information from db, in TileRequest.java's handleClientRequest();
After that, when the DB query is done, we try to send the data back with TileSendAnswer() to the client as a new SFSObject type, where the game is running, by the command: send("qt", so, q.user);
And this is where the bug happen on client side. Xcode log shows the following (we also send player pos data's by the extension at the same time)
Code: Select all
[SFS - INFO] Data Read: Binary Size: 186
80 00 b7 12 00 03 00 01 61 03 00 0c 00 01 63 02 ........a.....c.
00 00 01 70 12 00 02 00 01 75 04 00 00 00 00 00 ...p.....u......
02 76 6c 11 00 08 11 00 03 08 00 02 72 77 02 03 .vl.........rw..
07 3f f0 00 00 00 00 00 00 11 00 03 08 00 02 70 .?.............p
7a 02 03 07 bd d5 12 50 00 00 00 00 11 00 03 08 z......P........
00 02 70 79 02 03 07 00 00 00 00 00 00 00 00 11 ..py............
00 03 08 00 02 69 64 02 02 04 00 00 00 01 11 00 .....id.........
03 08 00 02 70 78 02 03 07 be f8 14 f4 00 00 00 ....px..........
00 11 00 03 08 00 02 72 79 02 03 07 80 00 00 00 .......ry.......
00 00 00 00 11 00 03 08 00 02 72 78 02 03 07 80 ..........rx....
00 00 00 00 00 00 00 11 00 03 08 00 02 72 7a 02 .............rz.
03 07 80 00 00 00 00 00 00 00 ..........
[SFS - DEBUG] Handling New Packet of size 186
[SFS - DEBUG] Handling Header Size. Length: 185 (small)
[SFS - DEBUG] Data size is 183
[SFS - DEBUG] Handling Data: 183, previous state: 0/183
[SFS - DEBUG] <<< Packet Complete >>>
[SFS - ERROR] Error handling data: Argument cannot be null.
Parameter name: TypeName at System.Type.GetType (System.String typeName) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.Sfs2Cs (ISFSObject sfsObj) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeSFSObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.Binary2Object (Sfs2X.Util.ByteArray data) [0x00000] in <filename unknown>:0
at Sfs2X.Entities.Data.SFSObject.NewFromBinaryData (Sfs2X.Util.ByteArray ba) [0x00000] in <filename unknown>:0
at Sfs2X.Core.SFSProtocolCodec.OnPacketRead (Sfs2X.Util.ByteArray packet) [0x00000] in <filename unknown>:0
at Sfs2X.Core.SFSIOHandler.HandlePacketData (Sfs2X.Util.ByteArray data) [0x00000] in <filename unknown>:0
[SFS - INFO] Data Read: Binary Size: 114
80 00 6f 12 00 03 00 01 61 03 00 0d 00 01 63 02 ..o.....a.....c.
01 00 01 70 12 00 03 00 01 72 04 00 00 00 01 00 ...p.....r......
01 63 08 00 02 71 74 00 01 70 12 00 03 00 01 72 .c...qt..p.....r
04 00 00 00 00 00 01 61 11 00 01 12 00 03 00 06 .......a........
54 49 4c 45 49 44 04 00 00 00 01 00 03 55 49 44 TILEID.......UID
05 00 00 00 00 00 00 00 01 00 04 64 61 74 61 12 ...........data.
00 01 00 01 72 04 00 00 00 00 00 01 69 04 00 00 ....r.......i...
00 00 ..
[SFS - DEBUG] Handling New Packet of size 114
[SFS - DEBUG] Handling Header Size. Length: 113 (small)
[SFS - DEBUG] Data size is 111
[SFS - DEBUG] Handling Data: 111, previous state: 0/111
[SFS - DEBUG] <<< Packet Complete >>>
[SFS - ERROR] Error handling data: Argument cannot be null.
Parameter name: TypeName at System.Type.GetType (System.String typeName) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.Sfs2Cs (ISFSObject sfsObj) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeSFSObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeSFSArray (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeSFSObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeSFSObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.DecodeSFSObject (Sfs2X.Util.ByteArray buffer) [0x00000] in <filename unknown>:0
at Sfs2X.Protocol.Serialization.DefaultSFSDataSerializer.Binary2Object (Sfs2X.Util.ByteArray data) [0x00000] in <filename unknown>:0
at Sfs2X.Entities.Data.SFSObject.NewFromBinaryData (Sfs2X.Util.ByteArray ba) [0x00000] in <filename unknown>:0
at Sfs2X.Core.SFSProtocolCodec.OnPacketRead (Sfs2X.Util.ByteArray packet) [0x00000] in <filename unknown>:0
at Sfs2X.Core.SFSIOHandler.HandlePacketData (Sfs2X.Util.ByteArray data) [0x00000] in <filename unknown>:0
Re: Error handling data: Argument cannot be null
Posted: 11 Mar 2014, 10:52
by Lapo
Thanks, we'll take a look and let you know.
Re: Error handling data: Argument cannot be null
Posted: 11 Mar 2014, 11:26
by alienwoods
thanks is andvance!
Re: Error handling data: Argument cannot be null
Posted: 11 Mar 2014, 12:42
by Lapo
Pretty weird case. I have taken your binary dump and decoded the Extension response:
Code: Select all
(short) a: 13
(byte) c: 1
(sfs_object) p:
(int) r: 1
(utf_string) c: qt
(sfs_object) p:
(int) r: 0
(sfs_array) a:
(sfs_object)
(int) TILEID: 1
(long) UID: 1
(sfs_object) data:
(int) r: 0
(int) i: 0
Then I created a small Unity APP that sends a request to an extension which in turn responds with the same data above.
Tested under Unity itself, works fine. Of course, didn't expect otherwise.
Exported for iOS and tested in the iPad simulator: works just fine as well
The worst part of the story is that according to the error messages you have reported the code flow inside the API is taking a completely wrong direction. It detects a serialized custom class, which is not present and from there it attempts to deserialize it which of course fails.
What the heck is going on, I don't know.
If you have checked the post I have linked in one of my previous replies you will notice that it's not the first time we receive these pretty weird and non-reproducible cases only under iOS.
Our impression is that the Exporter for iOS is bugged and is not translating the C# code correctly which results in unexpected runtime errors. Unfortunately the Export process is a total black box for us, so we have no idea what might be happening. What makes things worse is that without a reproducible case we can't submit a bug-report to Unity.
Re: Error handling data: Argument cannot be null
Posted: 11 Mar 2014, 13:43
by alienwoods
It's quite an intresting issue. However, we merged our extension to your ObjectMover example, and it also send correct data back, no lack of this class serialization error.
Maybe our implementation is wrong in the our main project?
Re: Error handling data: Argument cannot be null
Posted: 11 Mar 2014, 13:58
by Lapo
I don't think so. If it was it would cause errors even in a normal webplayer client, which is not the case.
Also the binary data that crashes the iOS exported project, is perfectly valid and can be run in the deserializer without a hitch.
I am still convinced that the problem is caused by the Unity exporter, unfortunately. However, the fact that is not reproducible makes it pretty annoying

Re: Error handling data: Argument cannot be null
Posted: 11 Mar 2014, 14:26
by alienwoods
As i read this topic:
http://forums.smartfoxserver.com/viewto ... 21&t=15279, i maybe it could happen because the received data is hammering the client. I mean the time between the send and receive is too minimal. Could this happen?