Instance of advice attribute is created twice.
See original GitHub issueHi again 😃
Another issue from my side.
I’ve updated my project to use MrAdvice from v.2.0.16 to v2.8.5 and noticed strange thing - the actual advice attribute instance is created twice. To check this behavior just put some output log into advice attribute ctor and You’ll see this log twice. I declare advice this way:
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public class AdviceAsyncAttribute : Attribute, IMethodAsyncAdvice
{
public AdviceAsyncAttribute()
{
Console.WriteLine("ctor AdviceAsyncAttribute");
}
public async Task Advise(MethodAsyncAdviceContext context)
{
Console.WriteLine("Before MethodAsync");
await context.ProceedAsync();
Console.WriteLine("After MethodAsync");
}
}
This behavior is on Windows with .NET Framework.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Spring annotation AOP called twice
I annotate my spring boot controller some functions with a custom annotation for logging purpose. However, I find the before advice is executed ......
Read more >Chapter 6. Aspect Oriented Programming with Spring
Advice is associated with a pointcut expression and runs at any join point matched by the pointcut (for example, the execution of a...
Read more >Stuck on borrowing the same variable twice? : r/rust
So I am trying to access an attribute in a vec of attributes, loop through those attributes, then call a mutable function in...
Read more >pyqgis - QGIS plugin triggers function twice
I have a plugin with a function (triggered by a button) that selects a specific layer by name, then shows its attribute table....
Read more >Common mistakes with React Testing Library
Advice: Avoid adding unnecessary or incorrect accessibility attributes. Not using @testing-library/user-event. Importance: medium // ❌ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, there is no guarantee an attribute is created once (or twice). So if you want to store extra data related to instances, you can use introduced fields, they’re designed for it. More details at https://github.com/ArxOne/MrAdvice/wiki/IntroducingFields
Sure, I’ll provide my example a little bit later 😃