private async Task InitializeAsync()

in src/Microsoft.Extensions.Configuration.AzureAppConfiguration/AzureAppConfigurationProvider.cs [751:810]


        private async Task InitializeAsync(IEnumerable<ConfigurationClient> clients, CancellationToken cancellationToken = default)
        {
            Dictionary<string, ConfigurationSetting> data = null;
            Dictionary<KeyValueSelector, IEnumerable<MatchConditions>> kvEtags = new Dictionary<KeyValueSelector, IEnumerable<MatchConditions>>();
            Dictionary<KeyValueSelector, IEnumerable<MatchConditions>> ffEtags = new Dictionary<KeyValueSelector, IEnumerable<MatchConditions>>();
            Dictionary<KeyValueIdentifier, ConfigurationSetting> watchedIndividualKvs = null;
            HashSet<string> ffKeys = new HashSet<string>();

            await ExecuteWithFailOverPolicyAsync(
                clients,
                async (client) =>
                {
                    data = await LoadSelected(
                        client,
                        kvEtags,
                        ffEtags,
                        _options.Selectors,
                        ffKeys,
                        cancellationToken)
                        .ConfigureAwait(false);

                    watchedIndividualKvs = await LoadKeyValuesRegisteredForRefresh(
                        client,
                        data,
                        cancellationToken)
                        .ConfigureAwait(false);
                },
                cancellationToken)
                .ConfigureAwait(false);

            // Update the next refresh time for all refresh registered settings and feature flags
            foreach (KeyValueWatcher changeWatcher in _options.IndividualKvWatchers.Concat(_options.FeatureFlagWatchers))
            {
                UpdateNextRefreshTime(changeWatcher);
            }

            if (_options.RegisterAllEnabled)
            {
                _nextCollectionRefreshTime = DateTimeOffset.UtcNow.Add(_options.KvCollectionRefreshInterval);
            }

            if (data != null)
            {
                // Invalidate all the cached KeyVault secrets
                foreach (IKeyValueAdapter adapter in _options.Adapters)
                {
                    adapter.OnChangeDetected();
                }

                Dictionary<string, ConfigurationSetting> mappedData = await MapConfigurationSettings(data).ConfigureAwait(false);

                SetData(await PrepareData(mappedData, cancellationToken).ConfigureAwait(false));

                _mappedData = mappedData;
                _kvEtags = kvEtags;
                _ffEtags = ffEtags;
                _watchedIndividualKvs = watchedIndividualKvs;
                _ffKeys = ffKeys;
            }
        }