public ExtensionProvider(
            IEnumerable <IExtensionLoader> loaders,
            IUpgradeAssistantConfigurationLoader configurationLoader,
            ExtensionInstanceFactory factory,
            IExtensionLocator extensionLocator,
            IOptions <ExtensionOptions> options,
            ILogger <ExtensionProvider> logger)
        {
            if (extensionLocator is null)
            {
                throw new ArgumentNullException(nameof(extensionLocator));
            }

            if (options is null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _factory             = factory ?? throw new ArgumentNullException(nameof(factory));
            _loaders             = loaders ?? throw new ArgumentNullException(nameof(loaders));
            _configurationLoader = configurationLoader ?? throw new ArgumentNullException(nameof(configurationLoader));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _extensions = new Lazy <IEnumerable <ExtensionInstance> >(() =>
            {
                var list = new List <ExtensionInstance>();

                var opts = options.Value;

                // Required extensions are required for all commands UA may handle, as opposed to other extensions that augment certain commands
                foreach (var path in opts.RequiredExtensions)
                {
                    LoadPath(path, isDefault: true);
                }

                // Required extensions must load, otherwise they may be turned off
                if (!opts.LoadExtensions)
                {
                    return(list);
                }

                foreach (var path in opts.DefaultExtensions)
                {
                    LoadPath(path, isDefault: true);
                }

                foreach (var path in opts.ExtensionPaths)
                {
                    LoadPath(path, isDefault: false);
                }

                foreach (var path in Registered.Select(extensionLocator.GetInstallPath))
                {
                    LoadPath(path, isDefault: false);
                }

                logger.LogInformation("Loaded {Count} extensions", list.Count);

                if (opts.AdditionalOptions.Any())
                {
                    list.Add(LoadOptionsExtension(opts.AdditionalOptions));
                }

                list.AddRange(opts.Extensions);

                return(list);

                void LoadPath(string path, bool isDefault)
                {
                    if (OpenExtension(path) is ExtensionInstance extension)
                    {
                        if (isDefault)
                        {
                            extension = extension with {
                                Version = opts.CurrentVersion
                            };
                        }

                        if (opts.CheckMinimumVersion && extension.MinUpgradeAssistantVersion is Version minVersion && minVersion > opts.CurrentVersion)
                        {
                            logger.LogWarning("Could not load extension from {Path}. Requires at least v{Version} of Upgrade Assistant and current version is {UpgradeAssistantVersion}.", path, minVersion, opts.CurrentVersion);
                        }
                        else
                        {
                            list.Add(extension);
                        }
                    }
                    else
                    {
                        logger.LogWarning("Could not load extension from {Path}", path);
                    }
                }
            });
        }