[英]An unhandled exception of type 'System.ExecutionEngineException' occurred in XXX.exe
I have a DLL file that is written in C++. 我有一个用C ++编写的DLL文件。 I am try to use in C++ DLL in my c# code. 我尝试在我的c#代码中使用C ++ DLL。 C++ method is called correctly but it gives error after process completed. 正确调用C ++方法,但在完成进程后会出错。
Exception Details: 例外细节:
completed.System.ExecutionEngineException was unhandled Message=Exception of type 'System.ExecutionEngineException' was thrown. completed.System.ExecutionEngineException未处理Message =抛出类型'System.ExecutionEngineException'的异常。
I got the same problem with this code: 我在这段代码中遇到了同样的问题:
[DllImport("camapi.dll", CharSet = CharSet.Unicode)]
private static extern CSTATUS_T CWRAPPER_GetFriendlyName(IntPtr pCameraBus, string sCamID, out StringBuilder sFriendlyName,
uint uBufferSizeInWords);
public static string CWRAPPER_GetFriendlyName(IntPtr pCameraBus, string sCamID)
{
var sFriendlyName = new StringBuilder(256);
var status = CWRAPPER_GetFriendlyName(pCameraBus, sCamID, out sFriendlyName, (uint)s.Capacity + 1);
return (status == CSTATUS_T.CSTATUS_SUCCESS) ? sFriendlyName.ToString() : "";
}
The problem was the "out" keyword. 问题是“out”关键字。 The example on MSDN doesn't have the 'out'. MSDN上的示例没有'out'。
Hope that helps someone... Simon 希望有人帮助......西蒙
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.