From b1eaa44021e334c70fbe08dd9f92baf41968f699 Mon Sep 17 00:00:00 2001 From: Christopher F Date: Mon, 26 Feb 2018 19:32:26 -0500 Subject: [PATCH] Don't attempt to load types with generic parameters as a module This fixes an issue where custom ModuleBases that contained a generic parameter would be loaded as a module - only to fail when trying to be built. Realistically, ModuleBases _should_ be abstract - but it was still a bug that we allowed them to be included as a module. --- src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs b/src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs index c0a7e9aca..cf0f82474 100644 --- a/src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs +++ b/src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs @@ -307,7 +307,8 @@ namespace Discord.Commands private static bool IsValidModuleDefinition(TypeInfo typeInfo) { return _moduleTypeInfo.IsAssignableFrom(typeInfo) && - !typeInfo.IsAbstract; + !typeInfo.IsAbstract && + !typeInfo.ContainsGenericParameters; } private static bool IsValidCommandDefinition(MethodInfo methodInfo)