Deserialization of XML not supported on IOS.

I am getting an error while trying to deserialize an XML file on IOS.

System.NotSupportedException: il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System.Reflection.Emit/AssemblyBuilder.cpp(20) : Unsupported internal call for IL2CPP:AssemblyBuilder::basic_init - System.Reflection.Emit is not supported.

It works fine on Developer mode on computer and on Android. Can anyone help me? The only help I can find when I search online is that a similar error is present with JSON and it can be solved by using another JSON library.

This error occurs because the library that you’re using is attempting to use System.Reflection.Emit with IL2CPP. Runtime code generation is not supported by IL2CPP because of the AOT compiler, that prevents the use of anything in System.Reflection.Emit.

You can learn more about it here.

I noticed that on iOS the xml serialization uses the reflection assembly only with .NET 4.0 runtime but not with the 3.5 runtime.