Notifies the profiler about objects in memory that are being referenced by the specified object.
HRESULT ObjectReferences( [in] ObjectID objectId, [in] ClassID classId, [in] ULONG cObjectRefs, [in, size_is(cObjectRefs)] ObjectID objectRefIds );
The ObjectReferences method is called for each object remaining in the heap after a garbage collection has completed. If the profiler returns an error from this callback, the profiling services will discontinue invoking this callback until the next garbage collection.
The ObjectReferences callback can be used in conjunction with the ICorProfilerCallback::RootReferences callback to create a complete object reference graph for the runtime. The common language runtime (CLR) ensures that each object reference is reported only once by the ObjectReferences method.
The object IDs returned by ObjectReferences are not valid during the callback itself, because the garbage collection might be in the middle of moving objects. Therefore, profilers must not attempt to inspect objects during an ObjectReferences call. When ICorProfilerCallback2::GarbageCollectionFinished is called, the garbage collection is complete and inspection can be safely done.