title: System.Activator.CreateInstance(Type type) throws exception Source:mscorlib
body: <p>I have an windows Form Application who throw this exception:</p>
  
  <pre><code>TargetSite:  System.Object CreateInstance(System.RuntimeType, Boolean, 
  Boolean, Boolean ByRef, System.RuntimeMethodHandleInternal ByRef, Boolean ByRef)
  Message: Exception has been thrown by the target of an invocation
  Source: mscorlib
  
  StackTrace:
  at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean 
  publicOnly, Boolean noCheck, Boolean&amp; canBeCached, 
  RuntimeMethodHandleInternal&amp; ctor, Boolean&amp; bNeedSecurityCheck)
  at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean 
  skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark)
  at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean 
  skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark)
  at System.Activator.CreateInstance(Type type, Boolean nonPublic)
  at System.Activator.CreateInstance(Type type)
  at Pronet.Login.FrmLoginMetro.LoadMDI_Form()
  </code></pre>
  
  <p>This happens only in one machine, I have a lot of machines who work without this error, so I'm not be able to debug in development machine..</p>
  
  <p>this is my code:</p>
  
  <pre><code> void LoadMDI_Form()
      {
          try
          {
              Application.DoEvents();
  
              lblStatus.Text = "Carregando objetos do Banco...";
              lblStatus.Refresh();
              ((Form)Activator.CreateInstance(tipo)).Show();
              Hide();
          }
          catch (Exception ex)
          {
              MessageFactory.CreateMessage(EstiloMensagem.WindowsForm).ErroInesperado(ex, Perfil.CodUsuario, Perfil.NomeUsuario);
              Application.Exit();//fecha o sistema  
          }
      }
  </code></pre>