Description
Between 1.0.2 and 2.0.0, PR #934 changed the behaviour of AddModulesAsync and ModuleBase when it implemented an overridable callback for modules when they were instantiated and built. In particular, it's this section of ModuleBuilder
, where an instance of the module is created to then call the OnModuleBuilding
method.
This has broken most help and documentation generators, since any call to AddModulesAsync and its variants now requires all of the module's dependencies to be available, even in a context where all the developer really wants is a ModuleInfo
to extract information from. This makes it extremely problematic to design automated tests which operate on ModuleInfo
instances, implement generalized help commands, and, in my case, static documentation site generators. I've personally hit all three of the aforementioned problems, but the last one is where things get really hairy.
In particular, I have an EF Core context which is a dependency of most modules - that is plainly not available in the docsite generator, and really shouldn't be either.
Any known workarounds are welcome. If the behaviour should remain as-is, it'd be nice to see the introduction of a reflection-only method that spits out a ModuleInfo
which you can operate on.