my code is working fine, but after 5-10 minutes, I get the following error;
Managed Debugging Assistant 'FatalExecutionEngineError' : 'The runtime has encountered a fatal error. The address of the error was at 0x641ad419, on thread 0x5d0c. 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.
Called from different threads;
InvokeUtil.getInstance.Calculate(localVal);
My Code;
public class InvokeUntil
{
private IntPtr m_object = IntPtr.Zero;
private static InvokeUntil Self;
private InvokeUntil()
{
this.m_object = InvokeUntil.DllCreateInstance();
}
[DllImport("xDll")]
private static extern IntPtr DllCreateInstance();
[DllImport("xDll")]
private static extern void DllDisposeInstance(IntPtr CSObject);
[DllImport("xDll")]
private static extern void DllCalculate(IntPtr pCSObject, byte[] pCurrentData, uint[] pResult);
public static InvokeUntil getInstance
{
get
{
if (InvokeUntil.Self == null)
InvokeUntil.Self = new InvokeUntil();
return InvokeUntil.Self;
}
}
public void Calculate(uint[] EffVal)
{
InvokeUntil.DllCalculate(m_object, Data.MyData, EffVal);
}
}
User contributions licensed under CC BY-SA 3.0