【发布时间】:2010-03-19 10:13:55
【问题描述】:
在我的 .net 应用程序中使用非托管 dll 并获得异常时遇到问题 “运行时遇到致命错误。错误地址位于线程 0xbb4 上的 0x79e71bd7。错误代码为 0xc0000005。此错误可能是 CLR 中的错误,也可能是用户代码的不安全或不可验证部分中的错误。此错误的常见来源包括 COM-interop 或 PInvoke 的用户编组错误,这可能会损坏堆栈。”
我的代码在下面......
[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);
并通过C#中的以下方法调用此方法
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);
}
以上两种方法来自.net中的包装器dll。
上面的方法是通过下面的代码调用的
aRc = Utility.objCITMSDLL.GetMonthMask(ref aRetMask,ref aMByte, aSt_Dow, aSt_Wk, aEn_Dow, aEn_Wk);
调用此方法时会抛出异常“FatalExecutionEngineError was detected”和顶部指定的异常消息。
【问题讨论】:
标签: .net