title: MakeGenericMethod/MakeGenericType on Xamarin.iOS
body: <p>I'm trying to figure out what the limitations really means when deploying for iOS from Xamarin.</p>
  
  <p><a href="http://developer.xamarin.com/guides/ios/advanced_topics/limitations/">http://developer.xamarin.com/guides/ios/advanced_topics/limitations/</a></p>
  
  <p>I was under the impression that you have no JIT and thus any MakeGenericMethod or MakeGenericType would NOT work as that would require JIT compilation.</p>
  
  <p>Also I understood that when running on the simulator, these restrictions does not apply since the simulator is not running in the full AOT (Ahead of Time) mode.</p>
  
  <p>After setting up my Mac so that I could deploy to my phone, I would except the following test to fail when running on the actual device (iPhone).</p>
  
  <pre><code>    [Test]
      public void InvokeGenericMethod()
      {
          var method = typeof(SampleTests).GetMethod ("SomeGenericMethod");
  
          var closedMethod = method.MakeGenericMethod (GetTypeArgument());
  
          closedMethod.Invoke (null, new object[]{42});
  
      }
  
      public static void SomeGenericMethod&lt;T&gt;(T value)
      {
      }
  
  
      private Type GetTypeArgument()
      {
          return typeof(int);
      }
  </code></pre>
  
  <p>The thing is that completes successfully and I can't really understand why. Does not this code require JIT compilation?</p>
  
  <p>In an effort to "make it break" , I also did a test with MakeGenericType.</p>
  
  <pre><code>    [Test]
      public void InvokeGenericType()
      {
          var type = typeof(SomeGenericClass&lt;&gt;).MakeGenericType (typeof(string));
  
          var instance = Activator.CreateInstance (type);
  
          var method = type.GetMethod ("Execute");
  
          method.Invoke (instance, new object[]{"Test"});
  
      }
  
  
  public class SomeGenericClass&lt;T&gt;
  {
      public void Execute(T value)
      {
  
      }
  }
  </code></pre>
  
  <p>How can this work when there is no JIT?</p>
  
  <p>Am I missing something ?</p>