Home Forums Support Error: Invalid callback signature in Project.Class.Serialize

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4349
    Anonymous
    Inactive

    I’m trying to create an app using Xamarin that will send a custom class via NetworkComms.

    I have a shared class to handle the NetworkComms-related code. The code runs fine in iOS, but in the Android project, I get the following error: Invalid callback signature in Project.Player.Serialize

    This error occurs when running this line of code (that works fine in iOS): NetworkComms.SendObject (“JoinRequest”, serverIP, serverPort, player);

    Where player is a the custom class that can be sent via iOS.

    I’ve looked online searching the error, and people have said that it’s a platform-dependent bug that should have been fixed. Do you have any idea how I’d fix it for my project?

    Thanks!

    #4350
    Anonymous
    Inactive

    Thought it’d be worth mentioning: the references are the same as they are in iOS, aside from using the Android version of the NetworkComms library. However, the NetworkComms library shows up as being on version 1.0.0.0 rather than 3.0.0.0 in the iOS references (even though I’m using the dll’s from the zip file I downloaded when I purchased NetworkComms).

    • This reply was modified 8 years, 9 months ago by .
    #4353
    Anonymous
    Inactive

    If it helps, this is the stack trace that I get from the exception:

      at ProtoBuf.Meta.CallbackSet.SanityCheckCallback (ProtoBuf.Meta.TypeModel model, System.Reflection.MethodInfo callback) [0x00049] in c:\Dev\protobuf-net\protobuf-net\Meta\CallbackSet.cs:61 
      at ProtoBuf.Meta.CallbackSet.set_BeforeSerialize (System.Reflection.MethodInfo value) [0x00000] in c:\Dev\protobuf-net\protobuf-net\Meta\CallbackSet.cs:74 
      at ProtoBuf.Meta.MetaType.SetCallbacks (System.Reflection.MethodInfo beforeSerialize, System.Reflection.MethodInfo afterSerialize, System.Reflection.MethodInfo beforeDeserialize, System.Reflection.MethodInfo afterDeserialize) [0x00007] in c:\Dev\protobuf-net\protobuf-net\Meta\MetaType.cs:204 
      at ProtoBuf.Meta.MetaType.ApplyDefaultBehaviour () [0x0069b] in c:\Dev\protobuf-net\protobuf-net\Meta\MetaType.cs:750 
      at ProtoBuf.Meta.RuntimeTypeModel.FindOrAddAuto (System.Type type, Boolean demand, Boolean addWithContractOnly, Boolean addEvenIfAutoDisabled) [0x00120] in c:\Dev\protobuf-net\protobuf-net\Meta\RuntimeTypeModel.cs:552 
      at ProtoBuf.Meta.RuntimeTypeModel.GetKey (System.Type type, Boolean demand, Boolean getBaseKey) [0x00000] in c:\Dev\protobuf-net\protobuf-net\Meta\RuntimeTypeModel.cs:718 

    What’s even more strange is that a project (a simple chat app that I created from the tutorials), that hasn’t been touched in months, that used to work now doesn’t work; I get the same exception.

    This post on Stack Overflow mentions the sanity check that is in the exception: http://stackoverflow.com/questions/6652860/deserializing-with-protobuf-net-over-ria-services

    • This reply was modified 8 years, 9 months ago by .
    #4357
    Anonymous
    Inactive

    What happens when you run the included iOS and android chat examples? These both use protobuf for serialisation.

    Regards,
    Marc

    #4358
    Anonymous
    Inactive

    I’m not sure, but I got it fixed – I emailed Marc Gravell who developed protobuf, and he said that before the Serialize(…) and Deserialize() methods, there shouldn’t be [ProtoBeforeSerialization] and [ProtoAfterDeserialization], respectively. Though I’m not sure what broke between it working on Android and it not working on Android using the same code. Maybe it was something in an Android or Xamarin update.

    Cheers for the help though!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.