title: A call to PInvoke function has unbalanced the stack. This is likely because the managed PInvoke .. (.NET 4)
body: <p>My project run successful without errors in .NET Frame work 3.5. But, When I target it to .NET Frame work 4. I got the error:</p>
  
  <p>"<strong>A call to PInvoke function has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature.</strong>"</p>
  
  <p>I used unmanaged library as below:</p>
  
  <pre><code>[StructLayout(LayoutKind.Sequential )]
  public class DGNElemCore
  {
      public int offset;
      public int size;
      public int element_id;
      public int stype;          
      public int level;
      public int type;
      public int complex;
      public int deleted;
      public int graphic_group;
      public int properties;
      public int color;
      public int weight;
      public int style;
      public int attr_bytes;       
      public IntPtr attr_data;  
      public int raw_bytes;
      public IntPtr raw_data;                 
  
  }
  
  [DllImport("DgnLib.dll", EntryPoint = "DGNOpen")]           
  public static extern IntPtr  DGNOpen(string fileName, int bUpdate)
  </code></pre>
  
  <p>Do you know how to fix this error ?</p>