Exemple #1
0
        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);
        }
Exemple #2
0
        public override RcwData GetRCWData(Address 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;
        }