Skip to content

GetPluginFiles method must not throw InvalidOperationException #7

@DevD4v3

Description

@DevD4v3

Implementations:

This exception occurs when the Plugins key does not exist in a configuration file as a json or .env.
This behavior should be changed for two reasons:

  • Violates the Principle of least astonishment. If the consumer does not want to load any plugins, then it should delete the configuration key, i.e. the Plugins key found in a configuration file and that's it.
    The expected behavior for the consumer is that no plugin is loaded, but the opposite happens: an exception is thrown.
    This surprises the consumer.
  • As the consumer has been surprised, then should create the configuration key with an empty value. However, if the consumer uses a .json file as source, an exception will still be thrown if an empty array appears in the Plugins section.
    See issue Cannot specify an empty array in the Plugins section of appsettings.json #6

If the consumer forgets to add the Plugins key in the configuration file, then the expected behavior is that no plugins are loaded. This is not a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeA change in one part of a software that potentially causes other components to failbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions