KingAOP
KingAOP copied to clipboard
"An entry with the same key already exists."
When creating two attributes it generates an "An entry with the same key already exists."
Ex: I have a method that add user and for this method I created two attributes one that authorization and another that time of excution both work but when set together it generates the error: "An entry with the same key already exists."
Due to the SortedList dictionary. Set the AspectPriority property https://github.com/AntyaDev/KingAOP/blob/7ef4777a90782cec704a545cd94045df8d33bc43/src/VS%202010/KingAOP/AspectWeaver.cs#L108
IEnumerable RetrieveAspects(MemberInfo member)
{
var aspects = new SortedList<int, object>(new InvertedComparer());
foreach (Aspect aspect in member.GetCustomAttributes(typeof(Aspect), false))
{
var instance = Activator.CreateInstance(aspect.GetType());
aspects.Add(aspect.AspectPriority, instance);
}
return aspects.Values;
}
Docs should mention this.