diff --git a/src/Autofac/Features/OpenGenerics/OpenGenericDecoratorRegistrationSource.cs b/src/Autofac/Features/OpenGenerics/OpenGenericDecoratorRegistrationSource.cs index 6e0d6e44c..3a3c027be 100644 --- a/src/Autofac/Features/OpenGenerics/OpenGenericDecoratorRegistrationSource.cs +++ b/src/Autofac/Features/OpenGenerics/OpenGenericDecoratorRegistrationSource.cs @@ -77,13 +77,20 @@ public IEnumerable RegistrationsFor(Service service, Fun return Enumerable.Empty(); } - private static IEnumerable AddDecoratedComponentParameter(Type decoratedParameterType, IComponentRegistration decoratedComponent, IEnumerable configuredParameters) + private static Parameter[] AddDecoratedComponentParameter(Type decoratedParameterType, IComponentRegistration decoratedComponent, IList configuredParameters) { var parameter = new ResolvedParameter( (pi, c) => pi.ParameterType == decoratedParameterType, (pi, c) => c.ResolveComponent(decoratedComponent, Enumerable.Empty())); - return new[] { parameter }.Concat(configuredParameters); + var resultArray = new Parameter[configuredParameters.Count + 1]; + resultArray[0] = parameter; + for (int i = 0; i < configuredParameters.Count; i++) + { + resultArray[i + 1] = configuredParameters[i]; + } + + return resultArray; } public bool IsAdapterForIndividualComponents => true;