Stack Trace for RPC is too long. Hard to Debug.

Options
Hi, apparently at some point I am trying to send a custom data type but get a "Exception: cannot serialize() customdata" which is fine, I would like to change it. But I am having difficult time trying to find it because the debug stack for rpcs is so long that it does not point me to the source(what I actually wrote).
Exception: cannot serialize(): SomeCustomData
ExitGames.Client.Photon.Protocol16.Serialize (ExitGames.Client.Photon.StreamBuffer dout, System.Object serObject, Boolean setType)
ExitGames.Client.Photon.Protocol16.SerializeObjectArray (ExitGames.Client.Photon.StreamBuffer dout, System.Object[] objects, Boolean setType)
ExitGames.Client.Photon.Protocol16.Serialize (ExitGames.Client.Photon.StreamBuffer dout, System.Object serObject, Boolean setType)
ExitGames.Client.Photon.Protocol16.SerializeHashTable (ExitGames.Client.Photon.StreamBuffer dout, ExitGames.Client.Photon.Hashtable serObject, Boolean setType)
ExitGames.Client.Photon.Protocol16.Serialize (ExitGames.Client.Photon.StreamBuffer dout, System.Object serObject, Boolean setType)
ExitGames.Client.Photon.Protocol16.SerializeParameterTable (ExitGames.Client.Photon.StreamBuffer stream, System.Collections.Generic.Dictionary`2 parameters)
ExitGames.Client.Photon.Protocol16.SerializeOperationRequest (ExitGames.Client.Photon.StreamBuffer stream, Byte operationCode, System.Collections.Generic.Dictionary`2 parameters, Boolean setType)
ExitGames.Client.Photon.EnetPeer.SerializeOperationToMessage (Byte opCode, System.Collections.Generic.Dictionary`2 parameters, EgMessageType messageType, Boolean encrypt)
ExitGames.Client.Photon.EnetPeer.EnqueueOperation (System.Collections.Generic.Dictionary`2 parameters, Byte opCode, Boolean sendReliable, Byte channelId, Boolean encrypt, EgMessageType messageType)
ExitGames.Client.Photon.PeerBase.EnqueueOperation (System.Collections.Generic.Dictionary`2 parameters, Byte opCode, Boolean sendReliable, Byte channelId, Boolean encrypted)
ExitGames.Client.Photon.PhotonPeer.OpCustom (Byte customOpCode, System.Collections.Generic.Dictionary`2 customOpParameters, Boolean sendReliable, Byte channelId, Boolean encrypt)
LoadBalancingPeer.OpRaiseEvent (Byte eventCode, System.Object customEventContent, Boolean sendReliable, .RaiseEventOptions raiseEventOptions) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/LoadbalancingPeer.cs:779)
NetworkingPeer.OpRaiseEvent (Byte eventCode, System.Object customEventContent, Boolean sendReliable, .RaiseEventOptions raiseEventOptions) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1018)
NetworkingPeer.RunViewUpdate () (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:4221)
PhotonHandler.Update () (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:165)
Are there any good ways to debug this?

Comments

  • [Deleted User]
    Options
    Hi @Dragon_Of_Dumpling,

    sadly the stack trace doesn't mention, where you are using the custom type, but it mentions its name: SomeCustomData. Having this information you can basically do a project-wide search for it to find usages.

    About the Custom Type: do you want to get rid of it or do you want to get it working to make use of it? For the second case, I would recommend taking a look at the Serialization in Photon documentation page, especially at the Custom Types chapter if you haven't done this already. There is an example how Unity's Vector2 is registered as a Custom Type which can be serialized by Photon.
  • Thank you for your response @Christian_Simon. I replaced the actual Custom Data name with the "SomeCustomData" for sharing it online. I actually build a byte conversion into the type to allow me to send SomeCustomData.bytes to send it as a Byte Array. This works well but there appears to be some not being send as a byte array or sent from somewhere I have not yet been able to find. I searched the project for any reference of the data type but no luck so far. My complaint is just that PunRPCs go through so many steps that the trace stack runs out of room before people are able to see their source of it making it difficult to debug. So I am trying to figure out if there is a way to make the trace longer or make it so that it hides steps that are part of photon so I can debug my code.
  • I found the bug. Manual Sniff. Thank you.