Ignore static constructors when creating types
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user