From ad07c85255bfba6659766e71b1290efe5baba64a Mon Sep 17 00:00:00 2001 From: Simon G Date: Mon, 5 Sep 2022 14:15:46 +0200 Subject: [PATCH] - check if create method returns same type as registration --- LightweightIocContainer.Validation/IocValidator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LightweightIocContainer.Validation/IocValidator.cs b/LightweightIocContainer.Validation/IocValidator.cs index ec5d9cd..9cce812 100644 --- a/LightweightIocContainer.Validation/IocValidator.cs +++ b/LightweightIocContainer.Validation/IocValidator.cs @@ -48,7 +48,7 @@ public class IocValidator if (registration is IWithFactoryInternal { Factory: { } } withFactoryRegistration) { - (from createMethod in withFactoryRegistration.Factory.CreateMethods + (from createMethod in withFactoryRegistration.Factory.CreateMethods.Where(m => m.ReturnType == registration.InterfaceType) select createMethod.GetParameters().Select(p => p.ParameterType) into parameterTypes select (from parameterType in parameterTypes