views:

1979

answers:

3

Hi,

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

+3  A: 

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.

yoav.aviram
+1  A: 

Looks like this indeed was the problem.

Thanks.

However, compiling the dependicies as Debug fixed the error and I can finally debug my app.

however, the Release is now broken . I now getting debug assertion failed errors...

Is there any way to config visual studio to ignore dependencies compilation type? (i.e even I run as Debug, I dont want to compile the dependencies as Debug.

ofer
A: 

The most important thing you need at this point is the stack. Why was _CRT_DEBUGGER_HOOK called?

MSalters