title: FatalExecutionEngineError while calling dll method
body: <p>In my program on this line:</p>
  
  <pre><code>int value = MTEConnect(auth_string, err);
  </code></pre>
  
  <p>I receive such exeption:</p>
  
  <pre><code>FatalExecutionEngineError 
  The runtime has encountered a fatal error. The address of the
  error was at 0x68c8a681, on thread 0x2334. The error code is
  0xc0000005. This error may be a bug in the CLR or in the unsafe
  or non-verifiable portions of user code. Common sources of this
  bug include user marshaling errors for COM-interop or PInvoke,
  which may corrupt the stack.
  </code></pre>
  
  <p>MTEConnect is imported such a way:</p>
  
  <pre><code>    [DllImport("mtesrl.dll", CharSet = CharSet.Ansi)]
      private static extern int MTEConnect(String pars, StringBuilder err);
  </code></pre>
  
  <p>What's the problem and how to fix it?</p>
  
  <p><strong>upd:</strong> I can reproduce the same problem on another machine, but I got a little more desriptive message:</p>
  
  <pre><code>Managed Debugging Assistant 'FatalExecutionEngineError' has detected a problem in 'C:\blahblah\MBClient\bin\Debug\MBClient.vshost.exe
  </code></pre>
  
  <p>Library itself is functional, because it can be used from another applications, I just can't use it from c#</p>