private IEnumerable <MethodInfo> MakeGenericMethods(MethodInfo declaringMethod)
        {
            var usages = declaringMethod.GetCustomAttributes <CallsMakeGenericMethodAttribute>();

            foreach (var usage in usages)
            {
                var methodDefinition = usage.FindMethodInfo(declaringMethod);

                if (methodDefinition == null)
                {
                    throw new InvalidOperationException(CommandsStrings.InvalidCallsMakeGenericMethodAttribute(declaringMethod.DeclaringType.FullName + "." + declaringMethod.Name));
                }

                foreach (var typeArgs in BindTypeArguments(new ArraySegment <Type>(usage.TypeArguments)).Distinct())
                {
                    MethodInfo boundMethod;
                    try
                    {
                        boundMethod = methodDefinition.MakeGenericMethod(typeArgs);
                    }
                    catch (ArgumentException)
                    {
                        // ignores type constraints violations
                        continue;
                    }
                    yield return(boundMethod);
                }
            }
        }