Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity Json.net System.Reflection.Emit error in iOS

Tags:

unity3d

I followed the instruction and include the link.xml in the asset folder but I still get the error. I think it might be related to deserializing dictionaries since the error comes right after:

 System.Collection.Generic.IDictionary'2:set_Item(TKey, TValue).

It looks like the link.xml has all the converters in it but maybe I'm missing something. This is the link to the link.xml

Here's the stack:

/Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System.Reflection.Emit/DynamicMethod.cpp(20) : Unsupported internal call for IL2CPP:DynamicMethod::create_dynamic_method - System.Reflection.Emit is not supported.   at System.Reflection.Emit.DynamicMethod.CreateDynMethod () [0x00000] in <filename unknown>:0 
  at System.Reflection.Emit.DynamicMethod.CreateDelegate (System.Type delegateType) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDefaultConstructor[T] (System.Type type) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContract (Newtonsoft.Json.Serialization.JsonContract contract) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateDictionaryContract (System.Type objectType) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract (System.Type objectType) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract (System.Type type) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, Boolean checkAdditionalContent) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <filename unknown>:0 
  at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <filename unknown>:0 
like image 265
jbassking10 Avatar asked Jan 05 '23 18:01

jbassking10


1 Answers

The error in this case is unrelated to managed code stripping or the link.xml file. This error occurs because the Newtonsoft JSON library is attempting to use System.Reflection.Emit with IL2CPP. Runtime code generation is not supported by IL2CPP, hence the error message.

This answer indicates there is a version of the Newtonsoft JSON library that will work with IL2CPP though, you may want to try it instead.

like image 109
Josh Peterson Avatar answered Jan 08 '23 06:01

Josh Peterson