diff --git a/src/Castle.Core/DynamicProxy/Internal/InvocationHelper.cs b/src/Castle.Core/DynamicProxy/Internal/InvocationHelper.cs index bad0f3d85..c6a0c7035 100644 --- a/src/Castle.Core/DynamicProxy/Internal/InvocationHelper.cs +++ b/src/Castle.Core/DynamicProxy/Internal/InvocationHelper.cs @@ -50,7 +50,7 @@ public static MethodInfo GetMethodOnType(Type type, MethodInfo proxiedMethod) var cacheKey = new CacheKey(proxiedMethod, type); - return cache.GetOrAdd(cacheKey, ck => ObtainMethod(proxiedMethod, type)); + return cache.GetOrAdd(cacheKey, static ck => ObtainMethod(ck.Method, ck.Type)); } private static MethodInfo ObtainMethod(MethodInfo proxiedMethod, Type type) diff --git a/src/Castle.Core/DynamicProxy/ProxyUtil.cs b/src/Castle.Core/DynamicProxy/ProxyUtil.cs index 5adc871fb..79bd61176 100644 --- a/src/Castle.Core/DynamicProxy/ProxyUtil.cs +++ b/src/Castle.Core/DynamicProxy/ProxyUtil.cs @@ -162,9 +162,9 @@ public static bool IsAccessible(Type type) /// The assembly to inspect. internal static bool AreInternalsVisibleToDynamicProxy(Assembly asm) { - return internalsVisibleToDynamicProxy.GetOrAdd(asm, a => + return internalsVisibleToDynamicProxy.GetOrAdd(asm, static a => { - var internalsVisibleTo = asm.GetCustomAttributes(); + var internalsVisibleTo = a.GetCustomAttributes(); return internalsVisibleTo.Any(attr => attr.AssemblyName.Contains(ModuleScope.DEFAULT_ASSEMBLY_NAME)); }); }