我在Unity3d项目中使用的类库中使用Google.ProtocolBuffersLite。 当试图在IOS上的应用程序中的myClass.cs中使用ParseFrom(System.Byte [] data)函数时,我得到以下异常:
---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Collections.Generic.EqualityComparer`1
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.ExecutionEngineException: Attempting to JIT compile method 'System.Collections.Generic.GenericEqualityComparer`1<Google.ProtocolBuffers.ExtensionRegistry/ExtensionIntPair>:.ctor ()' while running with --aot-only.
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0
at System.Collections.Generic.EqualityComparer`1[Google.ProtocolBuffers.ExtensionRegistry+ExtensionIntPair]..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Collections.Generic.Dictionary`2[Google.ProtocolBuffers.ExtensionRegistry+ExtensionIntPair,Google.ProtocolBuffers.IGeneratedExtensionLite].Init (Int32 capacity, IEqualityComparer`1 hcp) [0x00000] in <filename unknown>:0
at System.Collections.Generic.Dictionary`2[Google.ProtocolBuffers.ExtensionRegistry+ExtensionIntPair,Google.ProtocolBuffers.IGeneratedExtensionLite]..ctor () [0x00000] in <filename unknown>:0
at Google.ProtocolBuffers.ExtensionRegistry..cctor () [0x00000] in <filename unknown>:0 Exception.Message: An exception was thrown by the type initializer for Google.ProtocolBuffers.ExtensionRegistry
at Google.ProtocolBuffers.AbstractBuilderLite`2[TMessage,TBuilder].MergeFrom (System.Byte[] data) [0x00000] in <filename unknown>:0
使用protocolBuffersLite的过程是:
Api兼容级别:.net 2.0子集
Aot编译选项:空
剥离级别:已禁用