Collapse the table of content
Expand the table of content


Works exactly like the MFC macro ASSERT.




Specifies an expression (including pointer values) that evaluates to nonzero or 0.

Evaluates its argument. If the result is 0, the macro prints a diagnostic message and aborts the program. If the condition is nonzero, it does nothing.

The diagnostic message has the form

assertion failed in file <name> in line <num>

where name is the name of the source file, and num is the line number of the assertion that failed in the source file.

In the release version of your application, ISAPIASSERT does not evaluate the expression and thus will not interrupt the program. If the expression must be evaluated regardless of environment, use the ISAPIVERIFY macro in place of ISAPIASSERT. ISAPIASSERT is available only in the debug version of your application.

ISAPI applications do not have to use MFC. If MFC is not linked to your application, ISAPIASSERT provides the same ASSERT functionality. If your application is linked to the MFC, ISAPIASSERT simply calls MFC's ASSERT.

In an MFC ISAPI application, an assertion in debug mode will bring up a modal dialog box (ASSERT dialog boxes are now modal by default); this will interrupt or hang the execution. To suppress modal assertion dialogs, add the following lines to your project source file (projectname.cpp):

// For custom assert and trace handling with WebDbg
#ifdef _DEBUG
CDebugReportHook g_ReportHook;

Once you have done this, you can use the WebDbg tool (WebDbg.exe) to see the assertions. For information on using the WebDbg tool, see Viewing Trace Messages And Handling Asserts.

© 2015 Microsoft