private static MarshalByRefObject IsCurrentContextOK(RuntimeType serverType, object[] props, bool bNewObj) { MarshalByRefObject proxy = null; InitActivationServices(); ProxyAttribute proxyAttribute = GetProxyAttribute(serverType); if (object.ReferenceEquals(proxyAttribute, DefaultProxyAttribute)) { return(proxyAttribute.CreateInstanceInternal(serverType)); } proxy = proxyAttribute.CreateInstance(serverType); if (((proxy != null) && !RemotingServices.IsTransparentProxy(proxy)) && !serverType.IsAssignableFrom(proxy.GetType())) { throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Activation_BadObject"), new object[] { serverType })); } return(proxy); }
private static MarshalByRefObject IsCurrentContextOK(RuntimeType serverType, object[] props, bool bNewObj) { ActivationServices.InitActivationServices(); ProxyAttribute proxyAttribute = ActivationServices.GetProxyAttribute((Type)serverType); MarshalByRefObject marshalByRefObject; if (proxyAttribute == ActivationServices.DefaultProxyAttribute) { marshalByRefObject = proxyAttribute.CreateInstanceInternal(serverType); } else { marshalByRefObject = proxyAttribute.CreateInstance((Type)serverType); if (marshalByRefObject != null && !RemotingServices.IsTransparentProxy((object)marshalByRefObject) && !serverType.IsAssignableFrom(marshalByRefObject.GetType())) { throw new RemotingException(string.Format((IFormatProvider)CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Activation_BadObject"), (object)serverType)); } } return(marshalByRefObject); }