c# - Protobuf-net Attempting to JIT compile method '(wrapper dynamic-method) ClassExtensions.StringArray -


unity3d protobuf-net serialization. precompile runtimetypemodel , load , use serializing.

on ios still receiving following error:

executionengineexception: attempting jit compile method '(wrapper dynamic-method) classextensions.stringarray:proto_3 (object,protobuf.protowriter)' while running --aot-only.    @ system.delegate.createdelegate (system.type type, system.object firstargument, system.reflection.methodinfo method, boolean throwonbindfailure) [0x00000] in <filename unknown>:0    @ system.delegate.createdelegate (system.type type, system.reflection.methodinfo method, boolean throwonbindfailure) [0x00000] in <filename unknown>:0    @ system.delegate.createdelegate (system.type type, system.reflection.methodinfo method) [0x00000] in <filename unknown>:0    @ system.reflection.emit.dynamicmethod.createdelegate (system.type delegatetype) [0x00000] in <filename unknown>:0    @ protobuf.compiler.compilercontext.buildserializer (iprotoserializer head, protobuf.meta.typemodel model) [0x00000] in <filename unknown>:0  rethrow invalidoperationexception: not possible prepare serializer for: classextensions.stringarray   @ protobuf.compiler.compilercontext.buildserializer (iprotoserializer head, protobuf.meta.typemodel model) [0x00000] in <filename unknown>:0    @ protobuf.serializers.compiledserializer..ctor (iprototypeserializer head, protobuf.meta.typemodel model) [0x00000] in <filename unknown>:0    @ protobuf.serializers.compiledserializer.wrap (iprototypeserializer head, protobuf.meta.typemodel model) [0x00000] in <filename unknown>:0    @ protobuf.meta.metatype.compileinplace () [0x00000] in <filename unknown>:0    @ protobuf.meta.metatype.get_serializer () [0x00000] in <filename unknown>:0    @ protobuf.meta.runtimetypemodel.serialize (int32 key, system.object value, protobuf.protowriter dest) [0x00000] in <filename unknown>:0    @ protobuf.protowriter.writeobject (system.object value, int32 key, protobuf.protowriter writer) [0x00000] in <filename unknown>:0    @ protobuf.serializers.subitemserializer.protobuf.serializers.iprotoserializer.write (system.object value, protobuf.protowriter dest) [0x00000] in <filename unknown>:0    @ protobuf.serializers.tagdecorator.write (system.object value, protobuf.protowriter dest) [0x00000] in <filename unknown>:0    @ protobuf.serializers.listdecorator.write (system.object value, protobuf.protowriter dest) [0x00000] in <filename unknown>:0    @ protobuf.serializers.fielddecorator.write (system.object value, protobuf.protowriter dest) [0x00000] in <filename unknown>:0    @ protobuf.serializers.typeserializer.write (system.object value, protobuf.protowriter dest) [0x00000] in <filename unknown>:0    @ protobuf.meta.runtimetypemodel.serialize (int32 key, system.object value, protobuf.protowriter dest) [0x00000] in <filename unknown>:0    @ protobuf.meta.typemodel.serializecore (protobuf.protowriter writer, system.object value) [0x00000] in <filename unknown>:0    @ protobuf.meta.typemodel.serialize (system.io.stream dest, system.object value, protobuf.serializationcontext context) [0x00000] in <filename unknown>:0    @ protobuf.meta.typemodel.serialize (system.io.stream dest, system.object value) [0x00000] in <filename unknown>:0    @ routerconfig.save (system.string configfilename) [0x00000] in <filename unknown>:0    @ routerconfig.saverun () [0x00000] in <filename unknown>:0    @ console.update () [0x00000] in <filename unknown>:0  

here class:

using protobuf;  namespace classextensions {     //this class allow use serialize list<stringarray>     [protocontract]     public class stringarray     {         [protomember(1)] public string[] items { get; set; }         public stringarray() {}         public stringarray(string[] c) {this.items = c;}         //conversion string[] stringarray          public static implicit operator stringarray(string[] a)         { return new stringarray(a); }         //conversion stringarray string[]          public static implicit operator string[](stringarray a)         { return a.items; }         //conversion stringarray string[]            public static string[][] converttostringdoublearray(list<stringarray> a)         {             list<string[]> b = new list<string[]>();             foreach(stringarray c in a)                 b.add(c.items);             return b.toarray();         }         //used allow indexing...         public string this[int i]         {             { return this.items[i]; }             set { this.items[i] = value; }         }     } } 

compiling dll:

runtimetypemodel rmodel = typemodel.create();  rmodel.allowparseabletypes = true; rmodel.autoaddmissingtypes = true;  rmodel.add(typeof(stringarray), true);  rmodel.compile("myserializer", "myserializer.dll"); 

based on research should working. missing here?

figured out. issue although precompiled protobuf tried compile again. adding line code fixes it.

rmodel.autocompile = false; 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -