Browse Source

Ignore static constructors when creating types

tags/1.0-rc
Finite Reality 8 years ago
parent
commit
2f0881460c
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/Discord.Net.Commands/ReflectionUtils.cs

+ 1
- 1
src/Discord.Net.Commands/ReflectionUtils.cs View File

@@ -8,7 +8,7 @@ namespace Discord.Commands
{ {
internal static object CreateObject(TypeInfo typeInfo, CommandService service, IDependencyMap map = null) internal static object CreateObject(TypeInfo typeInfo, CommandService service, IDependencyMap map = null)
{ {
var constructors = typeInfo.DeclaredConstructors.ToArray();
var constructors = typeInfo.DeclaredConstructors.Where(x => !x.IsStatic).ToArray();
if (constructors.Length == 0) if (constructors.Length == 0)
throw new InvalidOperationException($"No constructor found for \"{typeInfo.FullName}\""); throw new InvalidOperationException($"No constructor found for \"{typeInfo.FullName}\"");
else if (constructors.Length > 1) else if (constructors.Length > 1)


Loading…
Cancel
Save