XXX.exe中发生了类型为'System.ExecutionEngineException'的未处理异常 [英] An unhandled exception of type 'System.ExecutionEngineException' occurred in XXX.exe

查看:397
本文介绍了XXX.exe中发生了类型为'System.ExecutionEngineException'的未处理异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用C ++编写的DLL文件.我尝试在我的C#代码中的C ++ DLL中使用. C ++方法被正确调用,但是在处理完成后会给出错误信息.

I have a DLL file that is written in C++. I am try to use in C++ DLL in my c# code. C++ method is called correctly but it gives error after process completed.

异常详细信息:

completed.System.ExecutionEngineException未处理 消息=类型为'System.ExecutionEngineException'的异常为 抛出.

completed.System.ExecutionEngineException was unhandled Message=Exception of type 'System.ExecutionEngineException' was thrown.

推荐答案

我在此代码上遇到了同样的问题:

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() : "";
}

问题出在"out"关键字上. MSDN上的示例没有'out'.

The problem was the "out" keyword. The example on MSDN doesn't have the 'out'.

希望可以帮助某人... 西蒙

Hope that helps someone... Simon

这篇关于XXX.exe中发生了类型为'System.ExecutionEngineException'的未处理异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆