Hi there, 
        
The issue DYNPROXY-ISSUE-80 was just created by Jose Cano Ruiz (ppcanodehuelva).
        
        Key: DYNPROXY-ISSUE-80
        Summary: DP2 cannot proxy ServiceModel.IChannel class. (Exception from 
HRESULT: 0x8007000B)
        Type: Bug
        Importance: High
        
        Description:
        Therefore wcf client proxies cannot access its IContextChannel 
interface, and the WcfFacility implementation creates proxies whose 
IContextChannel interface cannot be accessed (important limitation of the 
facility).
Unit test below:
------------------------------------------------------------------------------
namespace castle.tests.nunit.bug
{
    using System;
    using System.Collections.Generic;
    using System.ServiceModel;
    using System.ServiceModel.Channels;
    using Castle.Core;
    using Castle.Core.Interceptor;
    using Castle.Windsor;
    using Castle.DynamicProxy;
    using NUnit.Framework;
    [TestFixture(Description = "DP2 cannot proxy 
System.ServiceModel.IContextChannel, therefore retrieved clients through 
WcfFacility cannot access its IContextChannel")]
    /// <summary>
    /// DP2 must be able to proxy IContextChannel
    /// </summary>     
    /// <remarks>
    /// public interface IContextChannel : IChannel, ICommunicationObject, 
IExtensibleObject<IContextChannel>
    /// Problem example: 
http://groups.google.com/group/castle-project-users/browse_thread/thread/523a930eba69b76c
    /// WcfFacility uses WcfClientActivator.Instantiate to create the proxy of 
the wcf client
    /// Fails with BadImageFormatException: An attempt was made to load a 
program with an incorrect format. (Exception from HRESULT: 0x8007000B)
    /// </remarks>
    public class DynamicProxy_ServiceModelChannelTests
    {        
        IContract _target = null;
        ProxyGenerationOptions _opt = null;
        ProxyGenerator _proxyGenerator = null;
        Type _targetType = null;
        [ServiceContract]
        public interface IContract
        {
            [OperationContract]
            void Operation();
        }
             
        [TestFixtureSetUp]
        public void SetUp()
        {            
            _targetType = typeof(IContract);
            _target = ChannelFactory<IContract>.CreateChannel(new 
BasicHttpBinding(), new EndpointAddress("http://localhost:9010/s";));
            
            _opt = new ProxyGenerationOptions();
            _proxyGenerator = new ProxyGenerator();
        }
        [Test]
        public void ProxyClientChannel_And_ICommunicationObject()
        {
            assert_CreateInterfaceProxyWithTarget(typeof(ICommunicationObject));
        }
        [Test]
        public void ProxyClientChannel_And_IExtensibleObject()
        {
            
assert_CreateInterfaceProxyWithTarget(typeof(IExtensibleObject<IContextChannel>));
        }
        [Test]
        public void 
ProxyClientChannel_And_IExtensibleObject_ICommunicationObject()
        {
            
assert_CreateInterfaceProxyWithTarget(typeof(IExtensibleObject<IContextChannel>),
 typeof(ICommunicationObject));
        }
        /// <summary>
        /// FAILS
        /// </summary>
        [Test]
        public void ProxyClientChannel_And_IContextChannel()
        {
            assert_CreateInterfaceProxyWithTarget(typeof(IContextChannel));
        }
        /// <summary>
        /// FAILS
        /// </summary>
        [Test]
        public void ProxyClientChannel_And_IChannel()
        {
            assert_CreateInterfaceProxyWithTarget(typeof(IChannel));
        }
        void assert_CreateInterfaceProxyWithTarget(params Type[] interfaces)
        {            
            for (int i = 0; i < interfaces.LongLength; i++)
            {
                Assert.IsInstanceOfType(interfaces[i], _target);
            }            
            object proxy = 
_proxyGenerator.CreateInterfaceProxyWithTarget(_targetType, interfaces , 
_target, _opt, new StandardInterceptor());
            Assert.IsInstanceOfType(_targetType, proxy);
            for (int i = 0; i < interfaces.LongLength; i++)
            {
                Assert.IsInstanceOfType(interfaces[i], proxy);
            }            
        }        
    }
}
        
For more, see 
http://support.castleproject.org/projects/DYNPROXY/issues/view/DYNPROXY-ISSUE-80
 
        
--
donjon
by Castle Stronghold
http://www.castle-donjon.com



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to