none
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\doctempl.cpp

    Question

  • Hi,

    I just upgraded my compiler from Visual Studio 2005 to 2010 and successfully compile my application using VS2010.  However, when i try to run my application, I have the following run time error.  Can anyone tell me what is wrong or point me in the right direction to debug?  Thanks so much.

    Debug Assertion Failed!

    File:f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\doctempl.cpp

    Line:29

    Friday, September 03, 2010 12:48 AM

Answers

  • No. This applies to VC6 DLLs too.

    If your app works fine in VS2005, check whether you ported all projects. MFC classes are not binary compatible with another version of MFC.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Saturday, September 04, 2010 1:03 AM
  • Hi all,

    Sorry for the late reply.  Sheng is right, one of projects was not properly ported to VS2010 and still depended on MSCV80.dll.

    Thanks for your help.

    Raymond

    • Marked as answer by raymond2010 Thursday, September 09, 2010 11:37 PM
    Thursday, September 09, 2010 11:37 PM

All replies

  • Line 29

    pViewClass->IsDerivedFrom(RUNTIME_CLASS(CView)

    Are you exporting the view class from a regular DLL?



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Saturday, September 04, 2010 12:04 AM
  • Hi Sheng Jiang

    Yes.  I compiled all my packages into regular dlls.  Will this casue problems in Visual Studio 2010?  If so, how can i fix this problem?

    When you say 9, do you mean VS9.0?

    Thanks.

    Raymond

    Saturday, September 04, 2010 12:24 AM
  • That's a typo, sorry.

    If you static link MFC, the type information will be staticlly linked into the DLL, which means the address returned by RUNTIME_CLASS(CView) will be different from DLL to DLL, so if you call the code with a View object created in another DLL, you will get this error.

    In addition, if you import MFC classes, you need to make sure all DLLs are using the same version of MFC. E.g. the DLL version and the static linked version of MFC aren't binary compatible, so does the Debug and Release versions, Unicode and ANSI versions, regular and Extension DLL versions, etc. Use only C interfaces and avoid passing MFC objects to outside of the DLL/EXE if you can.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Saturday, September 04, 2010 12:46 AM
  • Hi Sheng Jiang,

    Is this new in Visual Studio 2010?  My application works fine when i compile it using Visual Studio 2005.

    Thanks for your reply.

    Raymond

    Saturday, September 04, 2010 12:59 AM
  • No. This applies to VC6 DLLs too.

    If your app works fine in VS2005, check whether you ported all projects. MFC classes are not binary compatible with another version of MFC.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Saturday, September 04, 2010 1:03 AM
  •  

    Hi,

     

    Did you solve your problem? If so please share the solution with us!

     

    Have a good day!

    Jesse


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, September 06, 2010 3:14 AM
  • Hi all,

    Sorry for the late reply.  Sheng is right, one of projects was not properly ported to VS2010 and still depended on MSCV80.dll.

    Thanks for your help.

    Raymond

    • Marked as answer by raymond2010 Thursday, September 09, 2010 11:37 PM
    Thursday, September 09, 2010 11:37 PM
  • Hi Sheng

    I am studying Visual Studio 2005 now.  However, when i try to run my application, I have the following run time error.  Can you tell me how to solve it?  Thanks so much.

    Debug Assertion Failed!

    File:f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\doctempl.cpp

    Line:29

    Friday, August 10, 2012 3:36 PM