internal static ComProxy Create(IntPtr outer, ContractDescription contract, IProvideChannelBuilderSettings channelBuilderSettings)
        {
            DispatchProxy proxy    = null;
            IntPtr        inner    = IntPtr.Zero;
            ComProxy      comProxy = null;

            try
            {
                proxy    = new DispatchProxy(contract, channelBuilderSettings);
                inner    = OuterProxyWrapper.CreateDispatchProxy(outer, proxy);
                comProxy = new ComProxy(inner, proxy);
                return(comProxy);
            }
            finally
            {
                if (comProxy == null)
                {
                    if (proxy != null)
                    {
                        ((IDisposable)proxy).Dispose();
                    }
                    if (inner != IntPtr.Zero)
                    {
                        Marshal.Release(inner);
                    }
                }
            }
        }
Esempio n. 2
0
        internal static ComProxy Create(IntPtr outer, ContractDescription contract, IProvideChannelBuilderSettings channelBuilderSettings)
        {
            DispatchProxy proxy = null;
            ComProxy      proxy3;
            IntPtr        zero   = IntPtr.Zero;
            ComProxy      proxy2 = null;

            try
            {
                proxy  = new DispatchProxy(contract, channelBuilderSettings);
                zero   = OuterProxyWrapper.CreateDispatchProxy(outer, proxy);
                proxy2 = new ComProxy(zero, proxy);
                proxy3 = proxy2;
            }
            finally
            {
                if (proxy2 == null)
                {
                    if (proxy != null)
                    {
                        ((IDisposable)proxy).Dispose();
                    }
                    if (zero != IntPtr.Zero)
                    {
                        Marshal.Release(zero);
                    }
                }
            }
            return(proxy3);
        }