Merge pull request #147 from DigiTechs/dev

Ignore static constructors when creating types
This commit is contained in:
RogueException
2016-07-27 18:04:08 -03:00
committed by GitHub

View File

@@ -8,7 +8,7 @@ namespace Discord.Commands
{
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)
throw new InvalidOperationException($"No constructor found for \"{typeInfo.FullName}\"");
else if (constructors.Length > 1)