diff --git a/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs b/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs index aa7d227088..cd83cea5fa 100644 --- a/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs +++ b/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs @@ -85,7 +85,10 @@ public void register_assembly_commands(IAssembly assembly) try { var types = assembly.get_loadable_types() - .Where(t => t.IsClass && !t.IsAbstract && typeof(ICommand).IsAssignableFrom(t) && t.GetCustomAttribute() != null); + .Where(t => t.IsClass && + !t.IsAbstract && + typeof(ICommand).IsAssignableFrom(t) && + t.GetCustomAttributes().Any()).ToList(); foreach (var t in types) { @@ -114,7 +117,7 @@ public void register_command(Type commandType) return; } - var commandForAttribute = commandType.GetCustomAttribute(); + var commandForAttribute = commandType.GetCustomAttributes().FirstOrDefault(); if (commandForAttribute == null) {