Reputation: 727
I have several methods that are using an attribute I built with the help of PostSharp. The attribute has 3 constructor overloads and each overload performs logic before the OnEntry() is called. The first time a method is hit with my attribute on it, it works fine. After that, the constructors are not being hit in my attribute and only the OnEntry() is firing.
I need the constructors to be called each time the method with the attribute is called. Does anyone know a solution for this?
Thanks in advance.
Upvotes: 0
Views: 352
Reputation: 23646
You can see another topic, which shows when constructors are run: When is a custom attribute's constructor run?
Postsharp access there attributes right after compilation, but before execution (this is called post compilation). The debugger is working properly for it, so you really can set a breakpoint at constructor and see the call stack to observe from what place this constructor was called.
Upvotes: 1
Reputation: 48279
Attribute constructors are not executed in the run time. PostSharp attributes are no exception for this rule.
I believe you'd have to redesign your approach. I am even suprised you claim that your constructor is hit once. I just check it and the attribute constructor is not hit at all in the run time.
Upvotes: 0