Example #1
0
        public override Object GetRealObject(StreamingContext context)
        {
            DBG.Info(DBG.SC, "SCM: GetRealObject()");

            if (!IsMarshaledObject)
            {
                DBG.Info(DBG.SC, "SCM: GetRealObject() returning objref!");
                return(this);
            }
            else
            {
                if (IsFromThisProcess() && !ServicedComponentInfo.IsTypeEventSource(_rt))
                {
                    Object otp = base.GetRealObject(context);
                    // We need to notify the object that there is a managed reference.
                    ((ServicedComponent)otp).DoSetCOMIUnknown(IntPtr.Zero);

                    return(otp);
                }
                else
                {
                    if (_rp == null)
                    {
                        _rp = _um.GetRealProxy();
                    }
                    DBG.Assert(_rp != null, "GetRealObject on a marshaller with no proxy!");
                    return(_rp.GetTransparentProxy());
                }
            }
        }