That's odd - you're still getting exception that the attribute can't be replicated? (if you're on trunk, you should get a nicer exeption message with suggestion of the solution).
And it happens AFTER this code is executed? That should not happen.
Can you move the ATRR.Add call earlier, to the earlies possible point in the app?

I don't see why it would do this...

Are you on the trunk or version 2.2 of DP?


On 26/06/2010 5:58 AM, Jan Limpens wrote:
Hm, does not seem to work...
I put it there...
         public  override  void  Initialized(IMonoRailContainer  cnt)

         {
             base.Initialized(cnt);
             ....
             AttributesToAvoidReplicating.Add<PrincipalPermissionAttribute>();

         }
gets me the same exception...

On Fri, Jun 25, 2010 at 4:54 PM, Jan Limpens <[email protected] <mailto:[email protected]>> wrote:

    Some hunting for duplicate references seems to indicate to me that
    dp has been moved into core. Does this mean I should ditch all my
    dp and dp2 dlls?


    2010/6/24 Krzysztof Koźmic <[email protected]
    <mailto:[email protected]>>

        That's a blacklist of attributes that are not inheritable and
        you don't want to replicate them onto the proxy.
        It's static, global class (for now - I think it should be
        scoped) where DP looks before trying to replicate
        each attribute type.

        All security-pseudo attribtues can be safely skipped and I'm
        leaning towards solution that I won't replicate them by
        default in vNext.

        KZU is using this for Moq with good results so far so I think
        that's the way to workaround this issue.
        Replicating security pseudoattributes does not make sense
        conceptually anyway.

        K


        On 24/06/2010 10:26 PM, Jan Limpens wrote:
        now, that sucks quite a bit...
        that AttributesToAvoidReplicating... thing, how does one use
        it, what does it do?

        2010/6/24 Krzysztof Koźmic <[email protected]
        <mailto:[email protected]>>

            Jan,

            http://kozmic.pl/archive/2010/04/15/select-is-broken-.net-4.aspx

            For now I suggest you call
            
AttributesToAvoidReplicating.Add<WhateverisCausingTheProblemAttribute>()

            Krzysztof



            On 24/06/2010 9:43 AM, Jan Limpens wrote:
            I have controller actions decorated with these attributes:




            [PrincipalPermission(SecurityAction.Demand, Role = "UserAdmin")]
            Since I upgraded to .net 4.0, I get these exceptions when trying to 
resolve one of those controllers from the container:


                /Parameter count does not match passed in argument
                value count./

            *Description:*An unhandled exception occurred during the execution 
of the current web request. Please review the stack trace for more information 
about the error and where it originated in the code.


            *Exception Details:*System.ArgumentException: Parameter count does 
not match passed in argument value count.

            *Source Error:*


            |An unhandled exception was generated during the
            execution of the current web request. Information
            regarding the origin and location of the exception can
            be identified using the exception stack trace below.|


            *Stack Trace:*

            ||
            [ArgumentException: Parameter count does not match passed in 
argument value count.]
                
System.Reflection.Emit.CustomAttributeBuilder.InitCustomAttributeBuilder(ConstructorInfo
 con, Object[] constructorArgs, PropertyInfo[] namedProperties, Object[] 
propertyValues, FieldInfo[] namedFields, Object[] fieldValues) +9462326
                
System.Reflection.Emit.CustomAttributeBuilder..ctor(ConstructorInfo con, 
Object[] constructorArgs, PropertyInfo[] namedProperties, Object[] 
propertyValues, FieldInfo[] namedFields, Object[] fieldValues) +22
                
Castle.DynamicProxy.AttributeUtil.CreateBuilder(CustomAttributeData attribute) 
+182
                
Castle.DynamicProxy.<GetNonInheritableAttributes>d__0.MoveNext() +369
                
Castle.DynamicProxy.Contributors.CompositeTypeContributor.ImplementMethod(MetaMethod
 method, ClassEmitter class, ProxyGenerationOptions options, 
CreateMethodDelegate createMethod) +257
                
Castle.DynamicProxy.Contributors.CompositeTypeContributor.Generate(ClassEmitter 
class, ProxyGenerationOptions options) +212
                
Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateType(String name, 
Type[] interfaces, INamingScope namingScope) +644
                
Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateCode(Type[] 
interfaces, ProxyGenerationOptions options) +1141
                
Castle.DynamicProxy.DefaultProxyBuilder.CreateClassProxyType(Type classToProxy, 
Type[] additionalInterfacesToProxy, ProxyGenerationOptions options) +151
                Castle.DynamicProxy.ProxyGenerator.CreateClassProxyType(Type 
classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions 
options) +61
                Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type 
classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions 
options, Object[] constructorArguments, IInterceptor[] interceptors) +329
                Castle.Windsor.Proxy.DefaultProxyFactory.Create(IKernel kernel, 
Object target, ComponentModel model, CreationContext context, Object[] 
constructorArguments) +579
                
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext
 context, Object[] arguments, Type[] signature) +1006

            [ComponentActivatorException: ComponentActivator: could not proxy 
Shop.Admin.Web.Controllers.UsersController]
                
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext
 context, Object[] arguments, Type[] signature) +1183
                
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext
 context) +119
                
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext
 context) +49
                
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext
 context) +50
                
Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext 
context) +46
                
Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, 
Boolean track) +212
                
Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context) 
+407
                Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler 
handler, Type service, IDictionary additionalArguments) +186
                Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler 
handler, Type service) +47
                Castle.MicroKernel.DefaultKernel.get_Item(Type service) +246
                Castle.MicroKernel.DefaultKernel.Resolve(Type service) +117
                
Castle.MonoRail.WindsorExtension.WindsorControllerFactory.CreateController(Type 
controllerType) +46
                
Castle.MonoRail.WindsorExtension.WindsorControllerFactory.CreateController(String
 area, String controller) +301
                
Castle.MonoRail.Framework.MonoRailHttpHandlerFactory.GetHandler(HttpContext 
context, String requestType, String url, String pathTranslated) +715

            [MonoRailException: Error creating controller users]
                
Castle.MonoRail.Framework.MonoRailHttpHandlerFactory.GetHandler(HttpContext 
context, String requestType, String url, String pathTranslated) +1101
                System.Web.HttpApplication.MapHttpHandler(HttpContext context, 
String requestType, VirtualPath path, String pathTranslated, Boolean 
useAppConfig) +203
                
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
 +128
                System.Web.HttpApplication.ExecuteStep(IExecutionStep step, 
Boolean&  completedSynchronously) +184


            
------------------------------------------------------------------------
            *Version Information:*  Microsoft .NET Framework 
Version:4.0.30319;ASP.NET  <http://ASP.NET>  Version:4.0.30319.1
            Commenting out these attributes resolves this (in a
            pretty sub optimal way)

            Any ideas?

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

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




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

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




-- Jan




--
Jan
--
You received this message because you are subscribed to the Google Groups "Castle Project Users" 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-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Castle 
Project Users" 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-users?hl=en.

Reply via email to