Browse Source

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.
tags/2.0
Christopher F 7 years ago
parent
commit
b1eaa44021
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs

+ 2
- 1
src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs View File

@@ -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)


Loading…
Cancel
Save