title: c# SetCompatibleTextRenderingDefault must be called before the first
body: <p>I tried to search for this exception but i couldn't find any solution on my case </p>
  
  <p>I'am using the code Below to invoke a .NET Application : </p>
  
  <pre><code>        Assembly assem = Assembly.Load(Data);
          MethodInfo method = assem.EntryPoint;           
          var o = Activator.CreateInstance(method.DeclaringType);            
          method.Invoke(o, null);
  </code></pre>
  
  <p>the Application that will be invoked has a Form and in the EntryPoint of the Application :</p>
  
  <pre><code>    [STAThread]
      static void Main()
      {
          Application.EnableVisualStyles();
          Application.SetCompatibleTextRenderingDefault(false); //Exception
          Application.Run(new Form1());
      }
  </code></pre>
  
  <p><code>SetCompatibleTextRenderingDefault</code> must be called before the first <code>IWin32Window</code> object is created in the application.</p>
  
  <p>EDIT : </p>
  
  <pre><code>        Assembly a = Assembly.Load(Data);
          MethodInfo method = a.GetType().GetMethod("Start");
          var o = Activator.CreateInstance(method.DeclaringType);            
          method.Invoke(o, null);
  </code></pre>