How to exclude a method from assembly advice #203
-
I have my own attribute class set at assembly level (via Directory.Build.Props file), so it it set on all projects automatically without coding. I have added another constructor with an extra argument to my attribute and added that to a method. However it seems that my new constructor is called, but also the default constructor. How can I tell MrAdvice to skip the default constructor and use only the one with the extra argument? [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] My method: [MyAttribute(exceptions: [typeof(SomeException)])] |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi, there is an |
Beta Was this translation helpful? Give feedback.
-
It will only let me apply this on class or struct level, not on a method? Attribute 'ExcludePointcut' is not valid on this declaration type. It is only valid on 'class, struct' declarations. |
Beta Was this translation helpful? Give feedback.
-
Oops ! My mistake, that attribute does not work this way. |
Beta Was this translation helpful? Give feedback.
Hi,
there is an
[ExcludePointcut]
attribute that you can apply at any method or type to exclude it from being advised.