title: Mark code to not run at design-time
body: <p>When using the new Xamarin.iOS designer, it will automatically create your controllers, views, etc. so your C# code runs and actually renders on the design surface (instead of having to wait until runtime).</p>
  
  <p>So if you have a controller, it's constructor and <code>ViewDidLoad</code> will be called.</p>
  
  <p>So let's say I have a controller like so:</p>
  
  <pre><code>class MyController
  {
      readonly ISomeService service;
  
      public MyController(IntPtr handle) : base(handle)
      {
          service = MyIoCContainer.Get&lt;ISomeService&gt;();
      }
  }
  </code></pre>
  
  <p>Obviously at design-time, the IoC container will be completely empty and throw an exception.</p>
  
  <p>Is there a way to solve this issue with the Xamarin.iOS designer? Perhaps <code>#if !DESIGN_TIME</code> or something to that nature? Or is there a way I could make my IoC container return a mock instance of all objects at design-time?</p>