Diagnostic Features

Visual Studio 6.0

The Microsoft Foundation Class Library (MFC) contains many diagnostic features to help debug your application during development. These features, especially those that track memory allocations, will slow down your program. Others, such as assertion testing, will cause your program to halt when erroneous conditions are encountered.

In a retail product, slow performance and program interruption are clearly unacceptable. For this reason, MFC provides a method for turning the debugging and diagnostic features on or off. When you are developing your program, you typically build a Win32 Debug version of your program and link with the debug version of MFC. Once the program is completed and debugged, you build a Win32 Release version and link with the release version of MFC.

Note   Before you can use many of the MFC diagnostic features, you must enable diagnostic tracing by setting the afxTraceEnabled flag and customizing the afxTraceFlags to the level of detail you would like to see in trace messages. The easiest way to make these settings is with the TRACER.EXE utility.

Open the Microsoft Visual C++ program group and double-click the MFC Tracer icon. For more information, see .

Also see Knowledge Base article Q117326 “MFC Common Asserts, Causes, and Solutions.” Knowledge Base articles are available by connecting to:


Choose a Microsoft product (Visual C++), enter the article ID (Q-number) and click Retrieve Article.

The following debugging features are included in all classes derived from CObject in the debug version of the MFC: