@JoshPeterson hello,I got a crash when app running on IOS .I use google protocol buffer-port the open source code from github.when use net protocol gennerated by google protocol buffer-port new an object it crashed.The error like this,
this caused by field in protocol which type is bool when google protocol buffer-port try to call the delegate that get value(CreateUpcastDeletegateImpl) method for field in protocol,but field in protocol which type is string it work fine ,when call CreateUpcastDeletegateImpl ,no error happened.Then I find field in protocol which type is bool,int ,int32,int64…it crashed,but string type work fine.
The Scripting Bankend use IL2CPP,I don’t know why field type which is string can find generate AOT code,but int,bool…come out error "no (AOT) code was generated.Can you have some suggestion for me,expecting your answer thank you…
This is a general problem with C# Ahead-of-time compilers (AOT). The same thing should happen on Mono AOT as well as IL2CPP (although Mono AOT is probably worth a try just to confirm). Both AOT compilers have trouble with generics that have value types (
int, etc.) as type arguments. Specifically, the AOT compiler needs to know about the types used at compilation, but serializers like Google Protocol buffers often create types at runtime. The AOT compiler can work with generics that have reference types as arguments (like
string) at runtime, so those fields work.
I’m not specifically familiar with Google Protocol buffers, but a search for “protocol buffers .NET aot” indicates that others have had this same problem. For example, this post might help you: