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]. 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