From 2026a323e0e03034860082b364d0beb7f965961f Mon Sep 17 00:00:00 2001 From: furkanaltaca <41112774+furkanaltaca@users.noreply.github.com> Date: Sat, 6 Mar 2021 11:31:23 +0300 Subject: [PATCH] Update AspectInterceptorSelector.cs In a situation where method is not public, I added some condition statement against an error of null attributes variable. --- Core/Utilities/Interceptors/AspectInterceptorSelector.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/Utilities/Interceptors/AspectInterceptorSelector.cs b/Core/Utilities/Interceptors/AspectInterceptorSelector.cs index 23c7c87..8c23347 100644 --- a/Core/Utilities/Interceptors/AspectInterceptorSelector.cs +++ b/Core/Utilities/Interceptors/AspectInterceptorSelector.cs @@ -15,9 +15,9 @@ public IInterceptor[] SelectInterceptors(Type type, MethodInfo method, IIntercep { var classAttributes = type.GetCustomAttributes (true).ToList(); - var methodAttributes = type.GetMethod(method.Name) + var methodAttributes = type.GetMethod(method.Name)? .GetCustomAttributes(true); - classAttributes.AddRange(methodAttributes); + if(methodAttributes != null) classAttributes.AddRange(methodAttributes); classAttributes.Add(new ExceptionLogAspect(typeof(FileLogger))); return classAttributes.OrderBy(x => x.Priority).ToArray();