title: Why does IoC has influence on Controller creation and how to fix that?
body: <p>I have strange issue in my ASP .NET MVC application. I have some controller and some <code>IHelper</code> and it's implementation <code>Helper</code> for this controller. When I use this helper like below:</p>
  <pre><code>public ActionResult SomeAction()
  {
      var hepler = new Helper();
      helper.DoStuff();
      ...
  }
  </code></pre>
  <p>every thing is OK. But When I try to inject this helper as property for controller:</p>
  <pre><code>public IHelper Helper { private get; set; }
  ...    
  public ActionResult SomeAction()
      {            
          Helper.DoStuff();
          ...
      }
  </code></pre>
  <p>and in my IoC configuration class I have:</p>
  <pre><code>ObjectFactory.Initialize(x =&gt;
            {
                // Helpers
                x.For&lt;IHelper&gt;().Use&lt;Helper&gt;();              
                ...
                x.FillAllPropertiesOfType&lt;IHelper&gt;().Use&lt;Helper&gt;();
                ...
            }
  </code></pre>
  <p>The thing is I have a LOT of different helpers, managers, repositories and other stuff initialized using IoC pattern in IoC configuration class and successfully injected to each of my controllers. But whe I try to inject this <code>Helper</code> I get:</p>
  <pre><code>InvalidOperationException: An error occurred when trying to create a controller of type 'MyController'. Make sure that the controller has a parameterless public constructor.
  </code></pre>
  <p>I know that the issue is in IoC and in this <code>Helper</code> because I googled <a href="http://www.ryanonrails.com/2012/05/30/mvc3-make-sure-that-the-controller-has-a-parameterless-public-constructor/" rel="nofollow noreferrer">this</a>, removed <code>Helper</code> from IoC configuration class, used it like <code>var hepler = new Helper();</code> and everything worked fine. But I can't understand what is the problem in? Did any one saw such issue before? I even can't understan how <strong>Make sure that the controller has a parameterless public constructor</strong> and <strong>IoC initializing of one of controllers properties</strong> can be related when everything works great for another helpers, etc.</p>
  <p><strong>EDITS</strong><br/>
  <strong>P.S.</strong> I am using StructureMap IoC framework and ASP .NET MVC 4.0.</p>