Can I debug???  
Author Message
vcboy





PostPosted: Visual C++ Language, Can I debug??? Top

Hi,
I worte an MFC program and compiled it in "Debug", but I compiled it in "Release" configuration. Then, I modified my code for additional functionality, but I can't debug the program anymore with "Debug" configuration. It gave me error like "Debug Assertion Failed" when I ran program in "Debug" mode. I do want to debug my program for its correctness. Do you have any idea how I can debug
Thanks,
vcboy


Visual C++12  
 
 
Brian Kramer





PostPosted: Visual C++ Language, Can I debug??? Top

An assertion in your program has fired. Assertions are enabled on debug builds and not on release builds. You are debugging, from what I can tell.

Where is the assertion (i.e. which line of code )


 
 
vcboy





PostPosted: Visual C++ Language, Can I debug??? Top

I was debugging from Debug mode. There are many kind of Debug Assertion Failure messages. One of them is in dlgdata.cpp file, line 342. It highlighted the follwoing line:

DDX_Text(pDX, IDC_EDIT_HELPLOCATION, m_strHelpLocation);

I don't know why it is causing the problem. What do you think of that If a program was compiled and run in Release mode, it can't go back to Debug mode for debugging

Thanks,

vcboy


 
 
Brian Kramer





PostPosted: Visual C++ Language, Can I debug??? Top

The assertion isn't the problem. There's a bug in your program and the assertion is advertising it. Maybe there is no text control with that id
 
 
cythe





PostPosted: Visual C++ Language, Can I debug??? Top

It is quite difficult to see why it is giving a debug assertion by looking at the above code. To have more clarity, start your program in debug mode (Press F5) and when it shows the assertion dialog, press retry. It will go to the line of the code that is failing the assertion. Copy that code here. It will be easier for us to understand why it is causing the assertion.

The immediate place after DDX_Text(...) that can cause the assertion is in CDataExchange::PrepareCtrl(int nIDC). Alernatively check whether the ID for your control is valid.

You can without any problems compile your code in debug mode after compiling it in release mode. The other way round might give problems in certain cases.