Well, first thing I believe is that you are using MFC.
Most of the MFC's code has ASSERT macros that show this dialog box, when something is not proper. For example, you write a function StrLen, which accepts a character-pointer:
int StrLen(const char* pString)
{
}
what is caller makes a mistake like:
char* p = NULL;
StrLen(p);
In this case, your function would cause access violation. Well, you can use
defensive programming using ASSERT as follows:
int StrLen(const char* pString)
{
ASSERT(pString != NULL);
}
In this case, if null (not empty string) is passed, your
StrLen
is defensing against null pointer, and this would cause "Debug Assertion Failed" dialog box.
An MFC method, like
SetWindowText
, would most probably defense itself for two concerns: Ensure the
CWnd
* (the
this
pointer is value, AND the window itself is value window/control. It is achieved through:
ASSERT(this != NULL);
ASSERT(::IsWindow(m_hWnd));
and if any of
assertion fails, you get that dialog box. Just click Retry and you will see a call stack. Find the bug and correct it!