- Home /
Serializing Custom Objects on IPhone(AoT Problem)
Hi, I have a program where I sent byte arrays over a Network Connection. For this reason I want to be able to actually Serialize Custom Objects to byte arrays.
I have this piece of code working fine.
BinaryFormatter bf = new BinaryFormatter ();
MemoryStream ms = new MemoryStream ();
bf.Serialize (ms, obj);
return ms.ToArray ();
But when I try to run it on IPhone or AoT mode only Systems. I get the dreaded Attempting to JIT Compile Method... because the binary formatter uses reflection.
Is there any way to add Compiler Hints or whatever so that the Serialization works on AoT Systems? Or is there a workaround maybe that enables me to convert custom Objects to byte arrays?
Greetings
You could try a different serializer like protobuf-net - which can generate the serialization methods at compile time
Your answer
Follow this Question
Related Questions
Serialization errors.. 0 Answers
Serialization reflection ExecutionEngineException on iPhone 1 Answer
How do I use deserialize XML with Unity Pro iPhone. 4 Answers
iPhone crashes when using a SerializationBinder 2 Answers
Serialization of custom class 1 Answer