Example #1
0
        [System.Security.SecurityCritical]  // auto-generated_required
        protected RealProxy(Type classToProxy, IntPtr stub, Object stubData)
        {
            if (!classToProxy.IsMarshalByRef && !classToProxy.IsInterface)
            {
                throw new ArgumentException(
                          Environment.GetResourceString("Remoting_Proxy_ProxyTypeIsNotMBR"));
            }
            Contract.EndContractBlock();

            if ((IntPtr)0 == stub)
            {
                Contract.Assert((IntPtr)0 != _defaultStub, "Default stub not set up");

                // The default stub checks for match of contexts defined by us
                stub = _defaultStub;
                // Start with a value of -1 because 0 is reserved for the default context
                stubData = _defaultStubData;
            }

            _tp = null;
            if (stubData == null)
            {
                throw new ArgumentNullException("stubdata");
            }
            _tp = RemotingServices.CreateTransparentProxy(this, classToProxy, stub, stubData);
            RemotingProxy rp = this as RemotingProxy;

            if (rp != null)
            {
                _flags |= RealProxyFlags.RemotingProxy;
            }
        }
 protected RealProxy(Type classToProxy, IntPtr stub, object stubData)
 {
     if (!classToProxy.IsMarshalByRef && !classToProxy.IsInterface)
     {
         throw new ArgumentException(Environment.GetResourceString("Remoting_Proxy_ProxyTypeIsNotMBR"));
     }
     if (IntPtr.Zero == stub)
     {
         stub     = _defaultStub;
         stubData = _defaultStubData;
     }
     this._tp = null;
     if (stubData == null)
     {
         throw new ArgumentNullException("stubdata");
     }
     this._tp = RemotingServices.CreateTransparentProxy(this, classToProxy, stub, stubData);
     if (this is RemotingProxy)
     {
         this._flags |= RealProxyFlags.RemotingProxy;
     }
 }
 protected RealProxy(Type classToProxy, IntPtr stub, object stubData)
 {
     if (!classToProxy.IsMarshalByRef && !classToProxy.IsInterface)
     {
         throw new ArgumentException(Environment.GetResourceString("Remoting_Proxy_ProxyTypeIsNotMBR"));
     }
     if (IntPtr.Zero == stub)
     {
         stub = _defaultStub;
         stubData = _defaultStubData;
     }
     this._tp = null;
     if (stubData == null)
     {
         throw new ArgumentNullException("stubdata");
     }
     this._tp = RemotingServices.CreateTransparentProxy(this, classToProxy, stub, stubData);
     if (this is RemotingProxy)
     {
         this._flags |= RealProxyFlags.RemotingProxy;
     }
 }
Example #4
0
        [System.Security.SecurityCritical]  // auto-generated_required
        protected RealProxy(Type classToProxy, IntPtr stub, Object stubData) 
        {
            if(!classToProxy.IsMarshalByRef && !classToProxy.IsInterface) 
            { 
                throw new ArgumentException(
                    Environment.GetResourceString("Remoting_Proxy_ProxyTypeIsNotMBR")); 
            }
            Contract.EndContractBlock();

            if((IntPtr)0 == stub) 
            {
                Contract.Assert((IntPtr)0 != _defaultStub, "Default stub not set up"); 
 
                // The default stub checks for match of contexts defined by us
                stub = _defaultStub; 
                // Start with a value of -1 because 0 is reserved for the default context
                stubData = _defaultStubData;
            }
 
            _tp = null;
            if (stubData == null) 
            { 
                throw new ArgumentNullException("stubdata");
            } 
            _tp = RemotingServices.CreateTransparentProxy(this, classToProxy, stub, stubData);
            RemotingProxy rp = this as RemotingProxy;
            if (rp != null)
            { 
                _flags |= RealProxyFlags.RemotingProxy;
            } 
        }