diff --git a/LightweightIocContainer/IocContainer.cs b/LightweightIocContainer/IocContainer.cs index 580f6c1..7124db7 100644 --- a/LightweightIocContainer/IocContainer.cs +++ b/LightweightIocContainer/IocContainer.cs @@ -168,8 +168,11 @@ public class IocContainer : IIocContainer, IIocResolver arguments = UpdateArgumentsWithRegistrationParameters(registrationWithParameters, arguments); List? resolveArguments = arguments?.ToList(); - if (resolveArguments != null && registration is IMultitonRegistration) - resolveArguments.RemoveAt(0); //remove scope argument for multitions + if (resolveArguments != null && registration is IMultitonRegistration multitonReg) //remove scope argument for multitions + { + object multitonScopeArgument = TryGetMultitonScopeArgument(multitonReg, resolveArguments); + resolveArguments.Remove(multitonScopeArgument); + } Type registeredType = GetType(registration); (bool result, List? parametersToResolve, NoMatchingConstructorFoundException? exception) =