debug assertion failed?
Ok here is my problem one day i changed something, i don't know what, and my program now gets this message
Debug assertion failed!
Program:....
File: dlgdata.cpp
Line: 44
What is that?
here is the code at and around that point
HWND CDataExchange::PrepareCtrl(int nIDC)
{
ASSERT(nIDC != 0);
ASSERT(nIDC != -1); // not allowed
HWND hWndCtrl;
COleControlSite* pSite = NULL;
m_pDlgWnd->GetDlgItem(nIDC, &hWndCtrl);
if (hWndCtrl == NULL)
{
// Could be a windowless OCX
pSite = m_pDlgWnd->GetOleControlSite(nIDC);
if (pSite == NULL)
{
TRACE(traceAppMsg, 0, "Error: no data exchange control with ID 0x%04X.\n", nIDC);
ASSERT(FALSE);
AfxThrowNotSupportedException();
}
}
m_idLastControl = nIDC;
m_bEditLastControl = FALSE; // not an edit item by default
return hWndCtrl;
}
Thanks for the help
i was unable to find the call stack in the menu anywhere but i am new at this so please forgive my ignorance. i did get the debug if it wouldhelp.
'demo.exe': Loaded 'C:\Documents and Settings\wburge\Desktop\demotest\demo\Debug\demo.exe', Symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
'demo.exe': Loaded 'C:\Documents and Settings\wburge\Desktop\demotest\demo\PSL_SerialDLL.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\mfc71d.dll', Symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\msvcr71d.dll', Symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\msvcp71d.dll', Symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\MFC71ENU.DLL', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\comctl32.dll', No symbols loaded.
'demo.exe': Loaded 'C:\Program Files\Stardock\ObjectDock\DockShellHook.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\clbcatq.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\comres.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\msi.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\cwui.ocx', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\mfc42.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\shell32.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\olepro32.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\msvcp60.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll', No symbols loaded.
'demo.exe': Loaded 'C:\WINDOWS\system32\msimg32.dll', No symbols loaded.
'demo.exe': Unloaded 'C:\WINDOWS\system32\msimg32.dll'
'demo.exe': Loaded 'C:\WINDOWS\system32\xpsp2res.dll', No symbols loaded.
Error: no data exchange control with ID 0x03EE.
'demo.exe': Loaded 'C:\Program Files\Yahoo!\Messenger\idle.dll', No symbols loaded.
'demo.exe': Loaded 'C:\Program Files\Yahoo!\Messenger\msvcr71.dll', No symbols loaded.
Unhandled exception at 0x7c25f2d1 (mfc71d.dll) in demo.exe: User breakpoint.
First-chance exception at 0x7c81eb33 in demo.exe: Microsoft C++ exception: CNotSupportedException @ 0x0012f1e0.
Warning: UpdateData failed during dialog init.
'demo.exe': Unloaded 'C:\WINDOWS\system32\cwui.ocx'
'demo.exe': Unloaded 'C:\WINDOWS\system32\msvcp60.dll'
'demo.exe': Unloaded 'C:\WINDOWS\system32\shell32.dll'
'demo.exe': Unloaded 'C:\WINDOWS\system32\mfc42.dll'
The thread 'Win32 Thread' (0x9f0) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xbf8) has exited with code 0 (0x0).
The program '[1140] demo.exe: Native' has exited with code 0 (0x0).
Thanks again.
surferboy wrote: |
| Debug assertion failed! Program:.... File: dlgdata.cpp Line: 44 What is that? |
|
A debug assertion is supposed to help you debug your program by causing it to blow up when some particular expression (the assertion) is false. That way you get to break into the debugger where the bad thing is happening and can figure out how and why it happened.
For example, at the start of the code you quoted is this...
| | HWND CDataExchange::PrepareCtrl(int nIDC) { ASSERT(nIDC != 0); |
If you were to call Prepare and pass in a zero value for nIDC then the expression within the ASSERT macro would be false and a debug assertion exception would occur.
Line 44 of dlgdata.cpp (in the April 2005 Platform SDK at least) is that AfxThrowNotSupportedException(); statement, but I think the line number is off by one (or possibly you are using a different version of dlgdata.cppp).
Getting to this code means both the hWndCtrl associated with nIDC and the pSite retrieved by calling GetOleControlSite were both NULL. Apparently that's a bad thing so the error handling logic calls ASSERT (FALSE) to throw an Assertion failure in debug cases and then calls AfxThrowNotSupportedException to throw a not supported exception in non-debug cases (becaiuse ASSERT macros have no effect in non debug builds)
If you are calling Prepare youself, look at the nIDC value you are passing in, it must be bad somehow. If prepare is being called for you, or as a consequence of your calling some other method then you need to figure out why the nIDC being passed to Prepare is bad.
| "Unhandled exception at 0x7c25f2d1 (mfc71d.dll) in demo.exe: User breakpoint." What is that. there is no breakpoint set. so why does it think that thier is? |
|
The Assertion failure is a breakpoint. The ASERT macro looks like this...
| | #define ASSERT(f) (void) ((f) || !AfxAssertFailedLine(THIS_FILE, __LINE__) || (AfxDebugBreak(), 0)) |
The AfxDebugBreak () call causes a breakpoint to occur.