public override RcwData GetRCWData(ulong obj) { // Most types can't possibly be RCWs. if (_notRCW) { return(null); } // The dac cannot report this information prior to v4.5. if (DesktopHeap.DesktopRuntime.CLRVersion != DesktopVersion.v45) { _notRCW = true; return(null); } DesktopRCWData result = null; IObjectData data = DesktopHeap.GetObjectData(obj); if (data != null && data.RCW != 0) { IRCWData rcw = DesktopHeap.DesktopRuntime.GetRCWData(data.RCW); if (rcw != null) { result = new DesktopRCWData(DesktopHeap, data.RCW, rcw); } } else if (!_checkedIfIsRCW) // If the first time fails, we assume that all instances of this type can't be RCWs. { _notRCW = true; // TODO FIX NOW review. We really want to simply ask the runtime... } _checkedIfIsRCW = true; return(result); }
public override CcwData GetCCWData(ulong obj) { if (_notCCW) { return(null); } // The dac cannot report this information prior to v4.5. if (DesktopHeap.DesktopRuntime.CLRVersion != DesktopVersion.v45) { return(null); } DesktopCCWData result = null; IObjectData data = DesktopHeap.GetObjectData(obj); if (data != null && data.CCW != 0) { ICCWData ccw = DesktopHeap.DesktopRuntime.GetCCWData(data.CCW); if (ccw != null) { result = new DesktopCCWData(DesktopHeap, data.CCW, ccw); } } else if (!_checkedIfIsCCW) { _notCCW = true; } _checkedIfIsCCW = true; return(result); }
public override bool IsRCW(ulong obj) { if (_checkedIfIsRCW) { return(!_notRCW); } // The dac cannot report this information prior to v4.5. if (DesktopHeap.DesktopRuntime.CLRVersion != DesktopVersion.v45) { return(false); } IObjectData data = DesktopHeap.GetObjectData(obj); _notRCW = !(data != null && data.RCW != 0); _checkedIfIsRCW = true; return(!_notRCW); }