c++/clr StructureToPtr exit application without any exception or error

空扰寡人 提交于 2019-12-12 01:53:48

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!