Question

Debug Assertion Failed!
File: f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\objcore.cpp Line: 40

I'm having this issue when I'm trying to DoModal(or Create) MFC window using debug configuration - Use MFC in a Static Library and Dynamic Library (.dll). On Release configuration everything is OK but I can't debug dll. MS VS 2010

Was it helpful?

Solution

It does not happen in the release build, since code is using ASSERT that has no meaning in the release build. ASSERT is a debug tool.

It may be a surprise to you but MFC does not use Windows modal dialog. Calling Create or DoModal creates windows modeless dialog. MFC achieves modality by disabling a parent window (if any) and supplies dialog with own message handling loop similar to application message loop.

That is why tou have the same result regardless of using Create or DoModal.

Does it happen before dialog is even shown?

The error you show in your post indicates that somewhere in your app code you are trying to use an object that has not been instantiated and is NULL during dialog initialization. It seems like it fails IsKindOf check.

Would it be possible to zip your project and post it for us do debug it?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top