Answered by:
Why Program works in debug but not release mode

Question
-
I have an application that uses MFC to create a window in visual studio 2005 c++.Net. It was develop in visual studio 2003. Since then it has been upgrade to visual studio 2005.
The way the application should work
- When the application works correctly there is one box area for data input and the three sub forms for output are displayed on the screen.
- The users input data in the data input area and select search.
- The program uses SQL to read the database
- The data found in the database is display in the three sub forms.
- The users can select a report to be run and the data is displayed in HTML window.
Debug Mode
- When I the run the application in debug mode it runs the source code without error.
- When I the compile the application in debug mode it compiles the source code without error.
- When I the run the application in debug mode it works fine. When I compile it in debug mode and install the exe the application works correctly.
- When I run the application it in debug mode the box area for data input is displayed on the screen and the three sub forms for output are displayed on the screen.
- All of the reports are displayed with Internet Explorer 7 and Internet Explorer 6
Release Mode
- When I compile it in release mode it compiles the source code without error.
- <!--[if !supportLists]-->· <!--[endif]-->When I install the release mode exe the application does not work correctly.
- <!--[if !supportLists]-->· <!--[endif]-->When I run the release mode only the box area for data input is are displayed on the screen and the three sub forms for output are not displayed on the screen.
- <!--[if !supportLists]-->· <!--[endif]-->If I have Internet Explorer 6 installed on the PC only the box area for data input is displayed on the screen and the three sub forms for output are not displayed on the screen.
- <!--[if !supportLists]-->· <!--[endif]-->If I have Internet Explorer 7 installed on the PC the box area for data input is displayed on the screen and the three sub forms for output are displayed on the screen.
- <!--[if !supportLists]-->· <!--[endif]-->If I have Internet Explorer 6 installed on the PC and run a report only the top half of the report is displayed.
- <!--[if !supportLists]-->· <!--[endif]-->If I have Internet Explorer 7 installed on the PC and run a report only the top half of the report is displayed.
- <!--[if !supportLists]-->· <!--[endif]-->I found that one of the dlls of the project is causing the problem.
- <!--[if !supportLists]-->· <!--[endif]-->If I take the dll from the debug mode compiled area and move it to the directory where the application is installed and replace the application release dll with the debug mode dll the application works correctly.
- <!--[if !supportLists]-->· <!--[endif]-->The application works correctly with Internet Explorer 7 and Internet Explorer 6.
- <!--[if !supportLists]-->· <!--[endif]-->The whole reports are displayed with Internet Explorer 7 and Internet Explorer 6
What I have done
<!--[if !supportLists]-->· <!--[endif]-->I deleted all the files from the release directory for the bad dll and did a new built.
<!--[if !supportLists]-->· <!--[endif]-->I have compare the last working copy property pages with the release built. Everything was the same.
Does any have any idea what is wrong?
Thank you,
Photomultiplier
Thursday, June 14, 2007 8:39 PM
Answers
-
Usually this is caused by few known common problems, you must be victom of one of those, Following articles might help,
Codeguru FAQ: Visual C++ Debugging: Why does program work in debug mode, but fail in release mode?
Debugging Release Mode Problems - The Code Project - Debug tips
Surviving the Release Version - The Code Project - Debug tips
Friday, June 15, 2007 7:09 AM
All replies
-
Hi,
Unfortunately, it could be anything. The most likely scenarios are bad synchronisation of data between threads or use of unitialised variables. You could also have buffer overruns and things like that although often they will be picked up in debug mode. Not much help, I guess.
John.
Thursday, June 14, 2007 10:46 PM -
Usually this is caused by few known common problems, you must be victom of one of those, Following articles might help,
Codeguru FAQ: Visual C++ Debugging: Why does program work in debug mode, but fail in release mode?
Debugging Release Mode Problems - The Code Project - Debug tips
Surviving the Release Version - The Code Project - Debug tips
Friday, June 15, 2007 7:09 AM