3.2.4 Message Processing Events and Sequencing Rules

The client determines if it is the server by matching values returned from the IManagedObject::GetObjectIdentity method. The client matches the value of pBSTRGUID against the GUID of the client CLR instance and uses the implementation-specific helper values in AppDomainID and pCCW to help decide if the COM object originated in the client CLR instance. Otherwise, the client fetches a binary-formatted string representation ([MS-NRBF] section 2.3) to the underlying managed object by using GetSerializedBuffer, which can be used to create a managed object.

When the IServiceComponentInfo interface is used, the client determines the server instance identity by means of the URI returned from the IServiceComponentInfo::GetComponentInfo method.

Note the following:

  • A COM reference to a CCW, as defined in [MSDN-CCW], keeps the managed object rooted for the garbage collection routine.

  • Managed object references also keep the object rooted for the garbage collection.

  • The garbage collection only collects an object once there are no longer COM object references to it and there are no further managed references to it.

  • In the event that the application domain that hosts the object is torn down, the CCW that implements IManagedObject is kept alive by the CLR, but calls to it will return failure HRESULT.