An unhandled exception of type "System.ExecutionEngineException" occurred in XXX.exe

I have a dll file written in C ++. I am trying to use a C ++ DLL in my C # code. The C ++ method is called correctly, but it gives an error after the process terminates.

Exception Details:

completed.System.ExecutionEngineException was not processed Message = An exception of type 'System.ExecutionEngineException' was thrown.

+4
source share
1 answer

I have 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 keyword "out". In the example on MSDN there is no "out".

Hope someone helps ... Simon

0
source

All Articles