title: FatalExecutionEngineError was detected
body: <p>I am facing a problem while using an unmanaged dll in my .net application and getting the exception 
  "The runtime has encountered a fatal error. The address of the error was at 0x79e71bd7, on thread 0xbb4. 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." </p>
  
  <p>my code is below....</p>
  
  <pre><code>[DllImport("ITMSDLL.dll")]
  internal static extern int get_month_mask(ref String theMask,ref  String theByt, int theSt_Dow, int theSt_Week, int theEn_Dow, int theEn_Week);
  </code></pre>
  
  <p>and callng this method by following method in C#</p>
  
  <pre><code>public int GetMonthMask(ref String theMask,ref  String theByt, int theSt_Dow, int 
          theSt_Week, int theEn_Dow, int theEn_Week)
          {
              return CITMSDLLMethods.get_month_mask(ref theMask, ref theByt, theSt_Dow,  
                  theSt_Week, theEn_Dow, theEn_Week);
          }
  </code></pre>
  
  <p>above two methods are from wrapper dll made in .net.</p>
  
  <p>and the above method is called by following code</p>
  
  <pre><code>aRc = Utility.objCITMSDLL.GetMonthMask(ref aRetMask,ref aMByte, aSt_Dow, aSt_Wk, aEn_Dow, aEn_Wk);
  </code></pre>
  
  <p>when calling this method it throws exception "FatalExecutionEngineError was detected" and the exception message specified in the top.</p>