_CRT_DEBUGGER_HOOK throws exception

試著忘記壹切 提交于 2020-02-02 03:15:48

问题


I'm having a problem converting my program from VS2005 to VS2008. When I run the program in VS2008, the application starts up fine but when start playing around with the application it crashes giving me this error:

"Microsoft Visual Studio C Runtime Library has detected a fatal error"

And then the debugger points me to this function:

__declspec(noinline)
void __cdecl _CRT_DEBUGGER_HOOK(int _Reserved)
{
/* assign 0 to _debugger_hook_dummy so that the function is not folded
in retail */
(_Reserved);
_debugger_hook_dummy = 0;
}

compiling the application ase release works prefectly...

By the way, this is a native code calling a managed c++ code that wrapps .NET code.

How can I debug such situation ?

Ofer


回答1:


Make sure all of your dependencies are also compiled with VS2008 debug.

I experienced this same issue when compiling a program in VS2008-debug, and some of the dependent DLLs where compiled in VS2003, and also when compiling a program in VS2008-debug and some of the dependencies where compiled as release.



来源:https://stackoverflow.com/questions/280477/crt-debugger-hook-throws-exception

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