|I still get the error
Managed Debugging Assistant 'FatalExecutionEngineError' has detected a problem in 'D:\Dev\Test_TA.exe'.
Additional Information: The runtime has encountered a fatal error. The address of the error was at 0x79f1c189, on thread 0x910. 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.
This error ocured when the function pointer in the unmanaged code call
to the function in the managed code.
In the managed code I uesd GCHandle::Aloc(this).