public static TInterface CreateEmptyProxy <TInterface>(DynamicMethodBinder methodBinder, Type binderType, Type ctorArgType, object ctorArg) where TInterface : class { Type interfaceType = typeof(TInterface); // derive unique key for this dynamic assembly by interface, channel and ctor type names var proxyName = $"{PROXY}_" + interfaceType.FullName + binderType?.FullName + $"_{Guid.NewGuid().ToString("N")}"; // get pooled proxy builder ProxyBuilder proxyBuilder = null; TInterface proxy = null; try { proxyBuilder = _proxies.Request(proxyName, () => CreateSimpleProxyBuilder(proxyName, interfaceType, methodBinder, binderType, ctorArgType)); proxy = CreateEmptyProxy <TInterface>(proxyBuilder, ctorArg); } finally { // return builder to the pool if (null != proxyBuilder) { _proxies.Release(proxyName, proxyBuilder); } } return(proxy); }