问题
I have a piece of code that transform a managed object into unmanaged object as per below,
static void M2N(M managed, N* pNative){
Marshal::StructureToPtr(managed, IntPtr(pNative), true);
};
my problem is after calling the above piece of code on certain struct, the code exits mysteriously without any exception, the tranformation is obviously unsuccessful (I have tried with some other struct, it works).
My question is how can I at least produce some exception, so that I know where went wrong?
来源:https://stackoverflow.com/questions/36038069/c-clr-structuretoptr-exit-application-without-any-exception-or-error