title: Repetive calling of C DLL in C# (using DLLimport)
body: <p>Using Mono (JIT compiler version 3.2.8) in Ubuntu 64bit, I am calling a C DLL within a C# source code using something like this:</p>
  
  <pre><code>[DllImport("/home/user/path/to/my.dll")]
  
  private static extern void mydll(int argument1, int argument2, ref int arguemnt3,             
                                  [MarshalAs(UnmanagedType.LPArray)] double[] argument4, 
                                  [MarshalAs(UnmanagedType.LPArray)] int[] argument5,
                                  string argument6)
  </code></pre>
  
  <p>This worked flawless on an older Ubuntu 32bit machine. Now, on my new 64bit machine I run into the following strange behavior.</p>
  
  <p>The first time I call the DLL in the C# source code it (apparently) works fine. The DLL returns arguments as expected and no error is raised. However, any further attempt to call the same DLL in the further code fails with following errors:</p>
  
  <pre><code>Stacktrace:
  
    at &lt;unknown&gt; &lt;0xffffffff&gt;
    at (wrapper managed-to-native) object.__icall_wrapper_mono_array_to_lparray (object) &lt;0xffffffff&gt;
    at (wrapper managed-to-native) mydll(int,int,int,int,int,int,int,double[],double[],double[],double[],double[],int&amp;,int&amp;,double[],double[],int,int[],int,double[],int,string,int,int,int,int) &lt;0xffffffff&gt;
    at mydll (System.Collections.Generic.Dictionary`2&lt;string, int&gt;,double[],double[],double[],System.Collections.Generic.Dictionary`2&lt;string, int&gt;,System.Collections.Generic.Dictionary`2&lt;string, double&gt;,string) &lt;0x0094b&gt;
    at Example.Main () &lt;0x00457&gt;
    at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) &lt;0xffffffff&gt;
  
  Native stacktrace:
  
      mono() [0x4b73d8]
      mono() [0x50f13b]
      mono() [0x423d22]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7f2898a2c340]
      mono() [0x550136]
      [0x4139cd9d]
  
  Debug info from gdb:
  
  Could not attach to process.  If your uid matches the uid of the target
  process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
  again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
  ptrace: Operation not permitted.
  No threads.
  
  =================================================================
  Got a SIGSEGV while executing native code. This usually indicates
  a fatal error in the mono runtime or one of the native libraries 
  used by your application.
  =================================================================
  </code></pre>
  
  <p>I am very new to C# and quite clueless why that happens.</p>
  
  <p>Maybe anyone could enlighten me?</p>
  
  <p>Thanks a lot!</p>