Interpreting Error Codes

After you have determined which application is the source of a problem, you need to find out what error has occurred. Errors are raised and reported in different formats, depending on the language your application uses.

In Microsoft Visual C++, success, warning, and failure values are returned using a 32-bit number known as a HRESULT. For a list of system-defined HRESULT values, see the header file Winerror.h included with the Windows SDK. This file includes all COM+ error codes and descriptions. For more information about HRESULT values, see Error Handling.

In the Java language, an instance of com.ms.com.ComFailException is thrown to indicate failure, where the ComFailException object specifies an HRESULT. An instance of com.ms.com.ComSuccessException indicates success with a return value of False. For information about interpreting these exceptions, see the Microsoft Visual J++ documentation.

Note

COM+ application server processes that are hosting Visual J++ objects will not idle down (even with zero active objects) unless you turn off JIT debugging in the VJ6 IDE. For information on how to do so, see the Visual J++ documentation.

In Visual Basic, you can retrieve HRESULT values by examining the Err.Number property. A description of the error can be retrieved with the Err.Description property.

You can also use the ERRLOOK utility in Microsoft Visual Studio to retrieve a system error message or module error message. ERRLOOK retrieves the error message text automatically if you drag-and-drop a hexadecimal or decimal value from the Visual Studio debugger or other Automation-enabled application. You can also enter a value by either typing it in or pasting it from the IDE clipboard and clicking the Look Up option.

The following C++ method prints a description of the error, based upon the input HRESULT.

#include <stdio.h>
#include <windows.h>
#include <tchar.h>

void ErrorDescription(HRESULT hr) 
{ 
     if(FACILITY_WINDOWS == HRESULT_FACILITY(hr)) 
         hr = HRESULT_CODE(hr); 
     TCHAR* szErrMsg; 

     if(FormatMessage( 
       FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, 
       NULL, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 
       (LPTSTR)&szErrMsg, 0, NULL) != 0) 
     { 
         _tprintf(TEXT("%s"), szErrMsg); 
         LocalFree(szErrMsg); 
     } else 
         _tprintf( TEXT("[Could not find a description for error # %#x.]\n"), hr); 
}

The following table provides descriptions of common error codes in COM+.

Error codes Definitions
COMADMIN_E_ALREADYINSTALLED
The object is already registered.
COMADMIN_E_APP_FILE_READFAIL
Error occurred reading the application file.
COMADMIN_E_APP_FILE_VERSION
Invalid version number in application file.
COMADMIN_E_APP_FILE_WRITEFAIL
Error occurred writing to the application file.
COMADMIN_E_APPDIRNOTFOUND
Application install directory was not found.
COMQC_E_APPLICATION_NOT_QUEUED
Only COM+ applications marked "queued" can be created using the "queue" moniker.
COMADMIN_E_APPLICATIONEXISTS
The application is already installed.
COMADMIN_E_APPLID_MATCHES_CLSID
A CLSID with the same GUID as the new application ID is already installed on this machine.
COMADMIN_E_APP_NOT_RUNNING
The specified application is not currently running.
COMADMIN_E_AUTHENTICATIONLEVEL
Unable to set required authentication level for update request.
COMADMIN_E_BADPATH
The file path is invalid.
COMADMIN_E_BADREGISTRYLIBID
The registered type library ID is invalid.
COMADMIN_E_BADREGISTRYPROGID
The component's ProgID is missing or corrupt.
COMADMIN_E_CAN_NOT_EXPORT_APP_PROXY
The application proxy is not exportable.
COMADMIN_E_CAN_NOT_START_APP
Failed to start application because it is either a library application or an application proxy.
COMADMIN_E_CAN_NOT_EXPORT_SYS_APP
The system application is not exportable.
COMADMIN_E_CANT_SUBSCRIBE_TO_COMPONENT
The user cannot subscribe to this component because the component may have been imported.
COMADMIN_E_CANTCOPYFILE
An error occurred copying the file.
COMADMIN_E_CLSIDORIIDMISMATCH
Application file CLSIDs or IIDs do not match corresponding DLLs.
COMADMIN_E_COMP_MOVE_BAD_DEST
The component move failed because the destination application no longer exists.
COMADMIN_E_COMP_MOVE_LOCKED
The component move was disallowed because the source or destination application either is a system application or is currently locked against changes.
COMADMIN_E_COMPFILE_BADTLB
The type library could not be loaded.
COMADMIN_E_COMPFILE_CLASSNOTAVAIL
The DLL does not support the components listed in the type library.
COMADMIN_E_COMPFILE_DOESNOTEXIST
This file does not exist.
COMADMIN_E_COMPFILE_GETCLASSOBJ
The GetClassObject method failed in the DLL.
COMADMIN_E_COMPFILE_LOADDLLFAIL
The DLL could not be loaded.
COMADMIN_E_COMPFILE_NOREGISTRAR
The component registrar referenced in this file is not available.
COMADMIN_E_COMPFILE_NOTINSTALLABLE
The file does not contain components or component information.
COMADMIN_E_COREQCOMPINSTALLED
A component in the same DLL is already installed.
COMADMIN_E_DLLLOADFAILED
The DLL could not be loaded.
COMADMIN_E_DLLREGISTERSERVER
The DllRegisterServer function failed when the component was installed.
COMADMIN_E_EVENTCLASS_CANT_BE_SUBSCRIBER
An event class cannot be configured as a subscriber component. When an attempt is made to create a subscription with an event class as a subscriber, this error is returned.
COMADMIN_E_INVALIDUSERIDS
One or more users in the application file are not valid.
COMADMIN_E_KEYMISSING
The object was not found in the catalog.
COMADMIN_E_LIB_APP_PROXY_INCOMPATIBLE
Library applications and application proxies are incompatible. This error is returned when an attempt is made to export an application proxy and the application's activation property is a library.
COMADMIN_E_NOREGISTRYCLSID
The component's CLSID is missing or corrupt.
COMADMIN_E_NOSERVERSHARE
No server file share is available.
COMADMIN_E_NOTCHANGEABLE
Changes to this object and its sub-objects have been disabled.
COMADMIN_E_NOTDELETEABLE
The delete function has been disabled for this object.
COMADMIN_E_NOTINREGISTRY
Object was not found in registry.
COMADMIN_E_NOUSER
One or more users are not valid.
COMADMIN_E_OBJECT_DOES_NOT_EXIST
One of the specified objects cannot be found.
COMADMIN_E_OBJECT_PARENT_MISSING
One of the objects being inserted or updated does not belong to a valid parent collection.
COMADMIN_E_OBJECTERRORS
Errors occurred accessing one or more objects. For more information, see the ErrorInfo collection.
COMADMIN_E_OBJECTEXISTS
The object you are attempting to add or rename already exists.
COMADMIN_E_OBJECTINVALID
One or more of the object's properties are missing or invalid.
COMADMIN_E_OBJECTNOTPOOLABLE
This object is cannot be pooled.
COMADMIN_E_PROPERTYSAVEFAILED
One or more property settings are either invalid or in conflict with each other.
COMADMIN_E_PROPERTY_OVERFLOW
The property value is too large.
COMADMIN_E_REGFILE_CORRUPT
The registration file is corrupt.
COMADMIN_E_REGISTERTLB
The system was unable to register the type library.
COMADMIN_E_REGISTRARFAILED
Errors occurred while in the component registrar.
COMADMIN_E_REMOTEINTERFACE
Interface information is either missing or changed.
COMADMIN_E_REQUIRES_DIFFERENT_PLATFORM
This operation is not enabled on this platform.
COMADMIN_E_ROLE_DOES_NOT_EXIST
A role assigned to a component, interface, or method does not exist in the application.
COMADMIN_E_ROLEEXISTS
The role already exists.
COMADMIN_E_SERVICENOTINSTALLED
The service is not installed.
COMADMIN_E_SESSION
The server catalog version is not supported.
COMADMIN_S_SOMEALREADYPAUSED
One or more of the specified application processes were already paused.
COMADMIN_S_SOMEALREADYRUNNING
One or more of the specified application processes were already running.
COMADMIN_E_START_APP_NEEDS_COMPONENTS
To start the application, you must have components in an application.
COMADMIN_E_SVCAPP_NOT_POOLABLE_OR_RECYCLABLE
The COM+ applications running as an NT service may not be marked as pooled or recycled.
COMADMIN_E_SYSTEMAPP
This operation cannot be performed on the system application.
COMADMIN_E_USER_IN_SET
One or more users are already assigned to a local partition set.
COMADMIN_E_USERPASSWDNOTVALID
The identity or password set on the application is not valid.

Fault Isolation and Failfast Policy

Finding the Source of an Error

How COM+ Modifies Return Values

Strategies for Handling Errors in COM+

Troubleshooting