title: Activator.CreateInstance() - Constructor not found
body: <p>I have the following class:</p>
  
  <pre><code>internal class MyQueryTranslator : ExpressionVisitor, IExpressionTranslator&lt;QueryRequest&gt;
  {
  
         private IReflectionManager _reflectionManager;
  
         internal MyQueryTranslator(IReflectionManager reflectionManager)
         {
             this._reflectionManager = reflectionManager;
         }
  
         //....
  }
  </code></pre>
  
  <p>Meanwhile, in another class, I am trying to instantiate this class using <code>Activator.CreateInstance()</code> method:</p>
  
  <pre><code>internal class MyPersistenceStrategy&lt;E&gt; : IAsyncPersistenceStrategy&lt;E&gt;
       where E : class, IPersistableEntity
  {
  
         private IReflectionManager _reflectionManager;
         private static readonly Dictionary&lt;Type, Type&gt; _translators;
  
         static MyPersistenceStrategy()
         {
               _translators = new Dictionary&lt;Type, Type&gt;()
               {
                    { typeof(QueryRequest), typeof(MyQueryTranslator) }
               }
         }
  
         private T TranslateExpression&lt;T&gt;(Expression expression)
         {
              if(_translators.ContainsKey(typeof(T))
                     throw new InvalidOperationException(String.Format("There is no translator for: {0}", typeof(T).Name);
  
              IExpressionTranslator&lt;T&gt; translator = 
                         (IExpressionTranslator&lt;T&gt;)Activator.CreateInstance(_translators[typeof(T)],
                                                 BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance,
                                                 null,
                                                 _reflectionManager,
                                                 null);
  
              return translator.Translate(expression);
         }
  
         //...
  
  }
  </code></pre>
  
  <p>However, I am getting the following error:</p>
  
  <blockquote>
    <p>An unhandled exception of type <code>System.MissingMethodException</code> occured in mscorlib.dll<br>
    Additional information: Constructor on type <code>XXXXX.MyQueryTranslator</code> not found</p>
  </blockquote>
  
  <p>As you can see, I am passing the appropiate <code>BindingFlgs</code> so the constructor can be actually found.</p>
  
  <p>The <code>TranslateExpression&lt;T&gt;</code> method is being called like this:</p>
  
  <pre><code>QueryRequest request = TranslateExpression&lt;QueryRequest&gt;(expression);
  </code></pre>
  
  <p>I should also note that both classes are in the same assembly.</p>