msgpack-cli icon indicating copy to clipboard operation
msgpack-cli copied to clipboard

AOT error can not be avoided.

Open st0326s opened this issue 7 years ago • 6 comments

When I executed the following code with actual machine, I got an AOT error.

Please tell me how to fix the error.

●Error Message Attempting to call method 'MsgPack.Serialization.SerializationContext::GetSerializer' for which no ahead of time (AOT) code was generated

●Code of error occurrence part

var deserializer = MessagePackSerializer.Get<Response>();

●Code I tried

MessagePackSerializer.PrepareType<Response>() 
var deserializer = MessagePackSerializer.Get<Response>();

But I got the same error.

●Use Dll URL=https://github.com/msgpack/msgpack-cli/releases

MsgPack.Cli.0.8.1.zip

●MsgPack.dll used for testing Folder is MsgPack.Cli.0.8.1\unity Folder is MsgPack.Cli.0.8.1\unity-full

But I got the same error.

●Code details The value "byte[] wwwBytes" of the "SuccessMsgpack" method contains the communication response www.bytes

●Excerpt of implemented code

    public class Response
    {
        public string releaseDatetime;
        public string userId;
    }

    public override void SuccessMsgpack(byte[] wwwBytes)
    {
        MemoryStream stream = new MemoryStream(wwwBytes);

        var deserializer = MessagePackSerializer.Get<Response>();
        object value = deserializer.Unpack(stream);

        Response dataClass = (Response)value;

        Debug.Log("ReleaseDatetime=" + dataClass.releaseDatetime);
        Debug.Log("UserId=" + dataClass.userId);
    }

●Development environment Unity5.5.1p1 Xcode8.2

●Test environment iPhone5se iOS8

st0326s avatar Feb 18 '17 10:02 st0326s

Thank you for reporting. I will investigate it and provide workaround or fix it.

yfakariya avatar Feb 19 '17 02:02 yfakariya

Thank you for the reply.

I will wait for it to be fixed

Currently I can not convert to class It converts it to a key value type, and extracts a value from there.

If this is the case, the correction cost is high, so I'd like to convert it to class somehow.

For Example

public override void SuccessMsgpack(byte[] wwwBytes)
{
    MemoryStream stream = new MemoryStream(wwwBytes);
    var rawObject = MessagePackSerializer.UnpackMessagePackObject( stream );
    var dataDic = rawObject.AsDictionary ();
    Response dataClass = new Response ();

    dataClass.releaseDatetime = (string)dataDic ["releaseDatetime"];
    dataClass.userId = (string)dataDic ["userId"];
}

st0326s avatar Feb 21 '17 05:02 st0326s

@st0326s Sorry for delay to tackle this problem, but I failed to reproduce your issue. Would you put actual stack trace or more info about build? I tried with:

  • Unity 5.5.1p1
  • Launch XCode as: Release
  • Checkboxes(I tried following combinatations):
    • Development build: off, Script Debugging: off
    • Development build: on, Script Debugging: on
  • MsgPack.dll from 0.8.1.zip

yfakariya avatar Mar 12 '17 07:03 yfakariya

One more question. What script backend did you use?(IL2CPP or mono 2.x)

yfakariya avatar Mar 12 '17 07:03 yfakariya

Sorry to be late replying.

There is no doubt the thing used below.

Unity 5.5.1 p1 Launch XCode as: Release Checkboxes (I tried following combinatations): Development build: off, Script Debugging: off Development build: on, Script Debugging: on MsgPack.dll from 0.8.1.zip

And I built it with IL2CPP.

Do you have any information?

st0326s avatar May 31 '17 15:05 st0326s

Thank you, but I have no ideas of it...

yfakariya avatar Jun 11 '17 11:06 yfakariya