BUG: CRuntimeClass Not Available for CInternetException

Last reviewed: February 19, 1998
Article ID: Q181207
The information in this article applies to:
  • The Microsoft Foundation Classes (MFC) included with: - Microsoft Visual C++, 32-bit Editions, version 5.0

SYMPTOMS

Attempting to obtain run-time class information for CInternetException by using the RUNTIME_CLASS macro fails. The CRuntimeClass structure returned for CInternetException is empty.

RESOLUTION

C++ exception handling can determine the type of exception thrown. A typical handler has a format similar to the following:

   try
   {
      // Execute some code that might throw an exception.
   }
   catch( CInternetException* e )
   {
      // Handle the Internet exception here.
   }
   catch( CException* e )
   {
      // Handle all other types of exceptions here.
   }

If for some reason it is still necessary to obtain the run-time class information for a class that may be CinternetException, it is possible to use the Run-Time Type Information (RTTI) provided by Visual C++. To use RTTI, the Run-Time Type Information must be enabled in the C++ Language settings for the project. Then, the dynamic_cast operator can be used to attempt a conversion of the exception to CInternetException. If the cast fails, the exception is of another type. It is also possible to obtain the Run-Time Type Information directly as follows:

   const type_info& info = typeid(*e);

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The following code demonstrates the problem:

   CRuntimeClass* prt;
   prt = RUNTIME_CLASS( CInternetException );

Looking at prt in the debugger shows that the CRuntimeClass structure is empty. This behavior is not observed in projects that are statically linked to MFC.


Additional query words: RTTI
Keywords : kbcode
Version : WINDOWS:97,97sp3
Platform : WINDOWS
Issue type : kbbug
Solution Type : kbpending


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 19, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.