Null reference when registering nested modules with no Lifespan attribute
Created by: ostorc
Summary
When registering transient module with nested module without Lifespan attribute you get null reference exception.
Details
Consider this example module:
[Group("test")]
[ModuleLifespan(ModuleLifespan.Transient)]
public class Module: BaseCommandModule
{
// ...
[Group(name: "subgroup")]
public class Nested : BaseCommandModule
{
// ...
}
}
you will get exception at https://github.com/DSharpPlus/DSharpPlus/blob/838ffc1489b80510cc24ab62ed252c28c51fe3f0/DSharpPlus.CommandsNext/CommandsNextExtension.cs#L423
because lifespan is null at this moment.
Few lines before this the null is checked but not here https://github.com/DSharpPlus/DSharpPlus/blob/838ffc1489b80510cc24ab62ed252c28c51fe3f0/DSharpPlus.CommandsNext/CommandsNextExtension.cs#L419