OK, my bad: since the target is an interface, I needed to call a different method:
CreateInterfaceProxyWithTargetInterface. Now it is working. The problem with the first method is that castle calls proxyTarget.GetInterfaceMapping(@interface), which throws an exception because the system call is expecting a concrete type here. Not sure why this wasn't a problem in the previous version of castle, but glad to have this fixed. Cheers, jorge On Aug 17, 5:49 pm, Krzysztof Koźmic <krzysztof.koz...@gmail.com> wrote: > could be. > > Can you reproduce it in test? > > On 18/08/2010 1:16 AM, Jorge wrote: > > > Hello! > > > I use nhibernate, and after switching to nhibernate 3.0, this code now > > throws an exception: > > (" 'this' type cannot be an interface itself.") > > > ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// > > private object CreateChannelProxy(Type serviceContract, > > IClientChannel channel) > > { > > lock(_proxyGenerator) > > { > > // get list of interceptors if not yet created > > if (_interceptors == null) > > { > > _interceptors = new List<IInterceptor>(); > > ApplyInterceptors(_interceptors); > > } > > > var options = new ProxyGenerationOptions(); > > > object rc = null; > > try > > { > > rc = > > _proxyGenerator.CreateInterfaceProxyWithTarget( > > serviceContract, > > new[] { serviceContract, typeof(IDisposable) }, > > channel, > > options, > > _interceptors.ToArray()); > > } > > catch (Exception e) > > { > > > throw; > > } > > > return rc; > > } > > } > > > } > > ////////////////////////////////////////////////////////////////////// > > > It used to work with: > > > castle core : 1.1 > > castle dynamic proxy 2: 2.1 > > > now broken with: > > > castle core : 1.2 > > castle dynamic proxy 2: 2.2 > > > Any ideas? From googling, it looks like the problem is that channel is > > already a proxy, and I am then trying to proxy a proxy. -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to castle-project-us...@googlegroups.com. To unsubscribe from this group, send email to castle-project-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.