title: Exception 'Attempting to JIT compile method, while running with --aot-only' with Google.ProtocolBuffersLite
body: <p>Im using Google.ProtocolBuffersLite in a class library that is used in my Unity3d project. 
  When attempting to use ParseFrom(System.Byte[] data)  function within myClass.cs in the app on IOS I get the following exception:</p>
  
  <pre><code>---&gt; System.TypeInitializationException: An exception was thrown by the type initializer for System.Collections.Generic.EqualityComparer`1 
  ---&gt; System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. 
  ---&gt; System.ExecutionEngineException: Attempting to JIT compile method 'System.Collections.Generic.GenericEqualityComparer`1&lt;Google.ProtocolBuffers.ExtensionRegistry/ExtensionIntPair&gt;:.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 &lt;filename unknown&gt;: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 &lt;filename unknown&gt;:0 
    at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in &lt;filename unknown&gt;:0 
    at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in &lt;filename unknown&gt;:0 
    at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in &lt;filename unknown&gt;:0 
    at System.Activator.CreateInstance (System.Type type) [0x00000] in &lt;filename unknown&gt;:0 
    at System.Collections.Generic.EqualityComparer`1[Google.ProtocolBuffers.ExtensionRegistry+ExtensionIntPair]..cctor () [0x00000] in &lt;filename unknown&gt;: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 &lt;filename unknown&gt;:0 
    at System.Collections.Generic.Dictionary`2[Google.ProtocolBuffers.ExtensionRegistry+ExtensionIntPair,Google.ProtocolBuffers.IGeneratedExtensionLite]..ctor () [0x00000] in &lt;filename unknown&gt;:0 
    at Google.ProtocolBuffers.ExtensionRegistry..cctor () [0x00000] in &lt;filename unknown&gt;: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 &lt;filename unknown&gt;:0 
  </code></pre>
  
  <p>The procedure to use protocolBuffersLite was:</p>
  
  <p><ol>
  <li>Add <em>option optimize_for = LITE_RUNTIME;</em> in my .proto class</li>
  <li>Generate .cs class using that .proto class and Google.ProtocolBuffers.dll version net20</li>
  <li>Add to my library csharp proj the .cs class and the Google.ProtocolBuffersLite.dll</li>
  <li>Compile with monoDevelop 2.8.2</li>
  <li>Move myLibraryThatUseProtocol.dll and Google.ProtocolBuffersLite.dll to myUnity3d project</li>
  <li>In Unity3D->Build Settings->IOS->PlayerSettings I use:</p>
  
  <blockquote>
    <p>Api Compatibility level: .net 2.0 subset</p>
    
    <p>Aot compilation options: empty</p>
    
    <p>Stripping level: Disabled</li>
    <li>Build app in Unity3d (version 4.2.0) </li>
    <li>Run app in Xcode</li>
    </ol>
    I will be grateful for any help somebody can provide.</p>
  </blockquote>