Tips to hide "Debug Assertion Failed!"

I am using Visual Studio 6.0 to develop a GUI software. Sometimes when I 
tested the software in a different OS, I can get the following error 
message:

"Microsoft Visual C++ Debug Library
Debug Assetion Failed!
Program:...
File: ...
Line: ..."

I do not like this kind of message box being displayed, since it looks like 
that I am releasing a "debug" version. In case there is an error occurred, I 
would like to use my own warning message box instead. For example, I would 
like to show "You have encountered a problem caused by your operating 
system. Try to run the software in Windows XP instead." Could anybody let me 
know if there is a back door that I can hide "Debug Assertion Failed" 
message in my software?

Thanks in advance.

Johnson





0
gpsabove (5)
6/19/2005 3:21:41 AM
vc.mfc 33608 articles. 0 followers. Follow

7 Replies
731 Views

Similar Articles

[PageSpeed] 4

Hello Johnson,

Hm... First of all, why are you releasing a debug version? Clients should 
not see this assert unless they are running the software which is linked 
to your debug module. Now, if you had released it without the assertion showing 
up, it could possibly crash unless the assertion was meaningless. Moral of 
the story here is to fix (if needed) the problems shown by the assertion. 


> I am using Visual Studio 6.0 to develop a GUI software. Sometimes when
> I tested the software in a different OS, I can get the following error
> message:
> 
> "Microsoft Visual C++ Debug Library
> Debug Assetion Failed!
> Program:...
> File: ...
> Line: ..."
> I do not like this kind of message box being displayed, since it looks
> like that I am releasing a "debug" version. In case there is an error
> occurred, I would like to use my own warning message box instead. For
> example, I would like to show "You have encountered a problem caused
> by your operating system. Try to run the software in Windows XP
> instead." Could anybody let me know if there is a back door that I can
> hide "Debug Assertion Failed" message in my software?
> 
> Thanks in advance.
> 
> Johnson
> 

-- 
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com


0
ajaykalra (6841)
6/19/2005 5:33:26 AM
There is a highly-effective way to "hide" this message box: fix the bug that caused it!

Note that you ARE released a debug version, which poses problems, because the debug DLLs
for MFC are not redistributable. ASSERTs do not come out in the release version; instead,
the program screws up in some other way, usually resulting in either misbehavior or
something more serious like an access fault. In the release version, ASSERTs compile out
and produce no code.

It would be inappropriate to have a message box that said "You have encountered a bug
caused by your operating system" when the truth is "I screwed up, and you are the victim".
An ASSERT fault is *always* a bug in your program. Fix it.

Why would you want to misrepresent your errors as operating system errors? Why would you
want to blame your bugs on Microsoft? Why would you not endeavor to fix the bugs you have
created?

Do the job right! Don't try to pretend the bug isn't yours when it is.
				joe


On Sat, 18 Jun 2005 21:21:41 -0600, "Johnson Liuis" <gpsabove@yahoo.com> wrote:

>I am using Visual Studio 6.0 to develop a GUI software. Sometimes when I 
>tested the software in a different OS, I can get the following error 
>message:
>
>"Microsoft Visual C++ Debug Library
>Debug Assetion Failed!
>Program:...
>File: ...
>Line: ..."
>
>I do not like this kind of message box being displayed, since it looks like 
>that I am releasing a "debug" version. In case there is an error occurred, I 
>would like to use my own warning message box instead. For example, I would 
>like to show "You have encountered a problem caused by your operating 
>system. Try to run the software in Windows XP instead." Could anybody let me 
>know if there is a back door that I can hide "Debug Assertion Failed" 
>message in my software?
>
>Thanks in advance.
>
>Johnson
>
>
>
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
6/19/2005 5:05:28 PM
Thanks for your reply, Joseph,

Just let you know that the rror message happened in a release version, not a 
debug version. I am sure in the "Active Configure" I selected "Win32 
Release", and that is why I got surprised. Any idea?

Johnson






"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:c79bb1p2dsgcr7nck6ne9hm4be1pj9ru81@4ax.com...
> There is a highly-effective way to "hide" this message box: fix the bug 
> that caused it!
>
> Note that you ARE released a debug version, which poses problems, because 
> the debug DLLs
> for MFC are not redistributable. ASSERTs do not come out in the release 
> version; instead,
> the program screws up in some other way, usually resulting in either 
> misbehavior or
> something more serious like an access fault. In the release version, 
> ASSERTs compile out
> and produce no code.
>
> It would be inappropriate to have a message box that said "You have 
> encountered a bug
> caused by your operating system" when the truth is "I screwed up, and you 
> are the victim".
> An ASSERT fault is *always* a bug in your program. Fix it.
>
> Why would you want to misrepresent your errors as operating system errors? 
> Why would you
> want to blame your bugs on Microsoft? Why would you not endeavor to fix 
> the bugs you have
> created?
>
> Do the job right! Don't try to pretend the bug isn't yours when it is.
> joe
>
>
> On Sat, 18 Jun 2005 21:21:41 -0600, "Johnson Liuis" <gpsabove@yahoo.com> 
> wrote:
>
>>I am using Visual Studio 6.0 to develop a GUI software. Sometimes when I
>>tested the software in a different OS, I can get the following error
>>message:
>>
>>"Microsoft Visual C++ Debug Library
>>Debug Assetion Failed!
>>Program:...
>>File: ...
>>Line: ..."
>>
>>I do not like this kind of message box being displayed, since it looks 
>>like
>>that I am releasing a "debug" version. In case there is an error occurred, 
>>I
>>would like to use my own warning message box instead. For example, I would
>>like to show "You have encountered a problem caused by your operating
>>system. Try to run the software in Windows XP instead." Could anybody let 
>>me
>>know if there is a back door that I can hide "Debug Assertion Failed"
>>message in my software?
>>
>>Thanks in advance.
>>
>>Johnson
>>
>>
>>
>>
>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm 


0
gpsabove (5)
6/20/2005 9:45:50 PM
Thanks for your reply, Ajay,

Just let you know that the rror message happened in a release version, not a 
debug version. I am sure in the "Active Configure" I selected "Win32 
Release", and that is why I got surprised. Any idea?

Johnson

"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message 
news:99288632547416080287552@msnews.microsoft.com...
> Hello Johnson,
>
> Hm... First of all, why are you releasing a debug version? Clients should 
> not see this assert unless they are running the software which is linked 
> to your debug module. Now, if you had released it without the assertion 
> showing up, it could possibly crash unless the assertion was meaningless. 
> Moral of the story here is to fix (if needed) the problems shown by the 
> assertion.
>
>> I am using Visual Studio 6.0 to develop a GUI software. Sometimes when
>> I tested the software in a different OS, I can get the following error
>> message:
>>
>> "Microsoft Visual C++ Debug Library
>> Debug Assetion Failed!
>> Program:...
>> File: ...
>> Line: ..."
>> I do not like this kind of message box being displayed, since it looks
>> like that I am releasing a "debug" version. In case there is an error
>> occurred, I would like to use my own warning message box instead. For
>> example, I would like to show "You have encountered a problem caused
>> by your operating system. Try to run the software in Windows XP
>> instead." Could anybody let me know if there is a back door that I can
>> hide "Debug Assertion Failed" message in my software?
>>
>> Thanks in advance.
>>
>> Johnson
>>
>
> -- 
> Ajay Kalra [MVP - VC++]
> ajaykalra@yahoo.com
>
> 


0
gpsabove (5)
6/20/2005 9:46:06 PM
Johnson Liuis wrote:
>>>"Microsoft Visual C++ Debug Library
>>>Debug Assetion Failed!
> Thanks for your reply, Ajay,
> 
> Just let you know that the rror message happened in a release version, not a 
> debug version. I am sure in the "Active Configure" I selected "Win32 
> Release", and that is why I got surprised. Any idea?
> 
> Johnson

The error message clearly shows that you have a debug library in your 
program, even though you selected the release configuration.  That 
probably means that your release build configuration settings have  a 
problem.  Check especially the MFC and "runtime" library setting in your 
release settings.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
6/20/2005 11:12:33 PM
Assert failures only come from the debug version. So you must have the symbol _DEBUG
defined somewhere, perhaps in a library build.  Note that ASSERT statements are different
from the sort of message that indicates an uncaught exception, which is a different
problem, and also represents a bug in your program.
					joe

On Mon, 20 Jun 2005 15:45:50 -0600, "Johnson Liuis" <gpsabove@yahoo.com> wrote:

>Thanks for your reply, Joseph,
>
>Just let you know that the rror message happened in a release version, not a 
>debug version. I am sure in the "Active Configure" I selected "Win32 
>Release", and that is why I got surprised. Any idea?
>
>Johnson
>
>
>
>
>
>
>"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
>news:c79bb1p2dsgcr7nck6ne9hm4be1pj9ru81@4ax.com...
>> There is a highly-effective way to "hide" this message box: fix the bug 
>> that caused it!
>>
>> Note that you ARE released a debug version, which poses problems, because 
>> the debug DLLs
>> for MFC are not redistributable. ASSERTs do not come out in the release 
>> version; instead,
>> the program screws up in some other way, usually resulting in either 
>> misbehavior or
>> something more serious like an access fault. In the release version, 
>> ASSERTs compile out
>> and produce no code.
>>
>> It would be inappropriate to have a message box that said "You have 
>> encountered a bug
>> caused by your operating system" when the truth is "I screwed up, and you 
>> are the victim".
>> An ASSERT fault is *always* a bug in your program. Fix it.
>>
>> Why would you want to misrepresent your errors as operating system errors? 
>> Why would you
>> want to blame your bugs on Microsoft? Why would you not endeavor to fix 
>> the bugs you have
>> created?
>>
>> Do the job right! Don't try to pretend the bug isn't yours when it is.
>> joe
>>
>>
>> On Sat, 18 Jun 2005 21:21:41 -0600, "Johnson Liuis" <gpsabove@yahoo.com> 
>> wrote:
>>
>>>I am using Visual Studio 6.0 to develop a GUI software. Sometimes when I
>>>tested the software in a different OS, I can get the following error
>>>message:
>>>
>>>"Microsoft Visual C++ Debug Library
>>>Debug Assetion Failed!
>>>Program:...
>>>File: ...
>>>Line: ..."
>>>
>>>I do not like this kind of message box being displayed, since it looks 
>>>like
>>>that I am releasing a "debug" version. In case there is an error occurred, 
>>>I
>>>would like to use my own warning message box instead. For example, I would
>>>like to show "You have encountered a problem caused by your operating
>>>system. Try to run the software in Windows XP instead." Could anybody let 
>>>me
>>>know if there is a back door that I can hide "Debug Assertion Failed"
>>>message in my software?
>>>
>>>Thanks in advance.
>>>
>>>Johnson
>>>
>>>
>>>
>>>
>>
>> Joseph M. Newcomer [MVP]
>> email: newcomer@flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm 
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
6/21/2005 1:34:17 AM
Hi Ajay,

Sorry to tell you that it was a release version, not a debug version. "Win32 
Release" was selected, and that was why I got confised.

Thanks.

Johnson


"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message 
news:99288632547416080287552@msnews.microsoft.com...
> Hello Johnson,
>
> Hm... First of all, why are you releasing a debug version? Clients should 
> not see this assert unless they are running the software which is linked 
> to your debug module. Now, if you had released it without the assertion 
> showing up, it could possibly crash unless the assertion was meaningless. 
> Moral of the story here is to fix (if needed) the problems shown by the 
> assertion.
>
>> I am using Visual Studio 6.0 to develop a GUI software. Sometimes when
>> I tested the software in a different OS, I can get the following error
>> message:
>>
>> "Microsoft Visual C++ Debug Library
>> Debug Assetion Failed!
>> Program:...
>> File: ...
>> Line: ..."
>> I do not like this kind of message box being displayed, since it looks
>> like that I am releasing a "debug" version. In case there is an error
>> occurred, I would like to use my own warning message box instead. For
>> example, I would like to show "You have encountered a problem caused
>> by your operating system. Try to run the software in Windows XP
>> instead." Could anybody let me know if there is a back door that I can
>> hide "Debug Assertion Failed" message in my software?
>>
>> Thanks in advance.
>>
>> Johnson
>>
>
> -- 
> Ajay Kalra [MVP - VC++]
> ajaykalra@yahoo.com
>
> 


0
gpsabove (5)
6/30/2005 8:54:55 PM
Reply:

Similar Artilces:

Tips to hide "Debug Assertion Failed!"
I am using Visual Studio 6.0 to develop a GUI software. Sometimes when I tested the software in a different OS, I can get the following error message: "Microsoft Visual C++ Debug Library Debug Assetion Failed! Program:... File: ... Line: ..." I do not like this kind of message box being displayed, since it looks like that I am releasing a "debug" version. In case there is an error occurred, I would like to use my own warning message box instead. For example, I would like to show "You have encountered a problem caused by your operating system. Try to run the sof...

using CFileException
When I call "GetErrorMessage" on the CFileException object, as in the following snipet, I get a "Debug Assertion Failed!" error dialog: Code snipet: ---------------------------------------------------------------------------- CString fileName = _T("C:\\someFile.xsd"); CFile XSDFile; CFileException fileException; if ( !XSDFile.Open(fileName, CFile::modeRead, &fileException) ) { // Problem opening the file, determine error TCHAR errCause[1024]; //TODO - Debug assertion raised on this line, why?? fileException.GetErrorMessage(errCause, 1024); ...

Debug assertion Failed! #4
Hi all! I have created an mfc application that would create a text file containing a comma-separated data. These data from the text file can be imported to Excel. Here's the scenario: I have generated/created a .txt file using the MFC application (ex. MyData.txt). After that, i opened the "MyData.txt" file in the Excel application: File-> Open-> MyData.txt-> Select 'Delimited' & Next-> Select 'Comma' & Finish The data was then imported by the Excel application. Afterwards, i run the MFC application again and created a .txt file with ...

Debug Assertion Failed! #2
While running my program in debug mode, I had the next problem and can't find out what's wrong. ------ Debug Assertion Failed! Program: c:\VC7\test.exe File : Occmgr.cpp Line: 410 Unhandled exception at 0x7c1a9b1e (mfc71d.dll) in test.exe: User breakpoint. ------ The last line in my code from where the mfc71d.dll is called is. BOOL CMediaPlanFrm::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { CSplitterWnd m_wndSplitter; if ( m_wndSplitter.CreateStatic( this, 2, 1 ) ) { m_wndSplitter.CreateView( 0, 0, RUNTIME_CLASS(CPlanboardView), CSize(400,350), pContext); // &...

Debug Assertion Failed!
Hi Pals, I am trying to create a application like Wanderer, a sample app provided by MS. I have created a SDI application using MFC wizard. I have attacted a TreeCtrl for display the Drives those are in my system. When i am trying to run my app, i am getting this following Error in popup window, Debug Assertion Failed! File: winsplit.cpp Line: 364 I tried via debug mode by setting breakpoints. if (!ProcessShellCommand(cmdInfo)) return FALSE; On this line i am geeting the err information. Give me a good solutions for how to eradicate this situation? Regards, Seenu. Infovation Inc. ...

Debug Assertion Failed! #3
Hi, I have a MFC project written by VS2005, the project has been put into use for almost 1 year, but recently when I execute this program ,it will turn out the following problem, Debug Assertion Failed! Program F:\.......\MyProject.exe File: F:\rtm\vctools\vc7libs\ship\atlmfc\src\mfc\winocc.cpp Line: 329 For information... Could anybody give me a help, thanks in advance! -ja Kinda hard to debug without some code to look at "jos" <josndrsn@yahoo.com> wrote in message news:#fiw6S3dIHA.1208@TK2MSFTNGP03.phx.gbl... > Hi, > I have a MFC project written ...

Debug Assertion Failed! File: winocc.cpp
In my COM Server i have added Dialog Box. i have registered OCX file and added that Activex Control to my Project also. It has created 1 header file and 1 source file. After that i have created an instance(object) of that ActiveX control and trying to call functions, But its giving run time error. Debug Assertion Filed! File: winocc.cpp Line: 345 Please help me karspy@gmail.com wrote: > In my COM Server i have added Dialog Box. i have registered OCX file > and added that Activex Control to my Project also. It has created 1 > header file and 1 source file. > > After that i...

using CFileException
When I call "GetErrorMessage" on the CFileException object, as in the following snipet, I get a "Debug Assertion Failed!" error dialog: Code snipet: ---------------------------------------------------------------------------- CString fileName = _T("C:\\someFile.xsd"); CFile XSDFile; CFileException fileException; if ( !XSDFile.Open(fileName, CFile::modeRead, &fileException) ) { // Problem opening the file, determine error TCHAR errCause[1024]; //TODO - Debug assertion raised on this line, why?? fileException.GetErrorMessage(errCause, 1024); ...