private CertificateInformation[] LoadCertificates(StoreName storeName, bool refreshCache) { CertificateInformation[]? certificates; if (refreshCache || !m_certificatesCache.TryGetValue(storeName, out certificates)) { m_logger.LogInformation(Tag.Create(), "Updating certificates cache for store '{0}'.", storeName); certificates = m_certificateStore.GetAllCertificates(storeName, StoreLocation.LocalMachine).ToArray(); m_logger.LogInformation(Tag.Create(), "Inserting '{0}' certificates to certificates cache for store '{1}'.", certificates.Length, storeName); m_certificatesCache[storeName] = certificates; } return(certificates ?? Array.Empty <CertificateInformation>()); }