Repository: Azure/azure-sdk-for-net
File: sdk/identity/Azure.Identity/src/X509Certificate2FromPathProvider.cs (C#)

Code before:
﻿// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core;

namespace Azure.Identity
{
    /// <summary>
    /// X509Certificate2FromPathProvider provides an X509Certificate2 from a "pfx" and "pem" encoded certificates
    /// on disk, and the platform certificate store.
    /// </summary>
    internal sealed class X509Certificate2FromPathProvider : IX509Certificate2Provider
    {
        // Lazy initialized on the first call to GetCertificateAsync, based on CertificatePath.
        private X509Certificate2 Certificate { get; set; }
        internal string CertificatePath { get; }
        internal string CertificatePassword { get; }

        public X509Certificate2FromPathProvider(string clientCertificatePath, string certificatePassword)
        {
            Argument.AssertNotNull(clientCertificatePath, nameof(clientCertificatePath));
            CertificatePath = clientCertificatePath ?? throw new ArgumentNullException(nameof(clientCertificatePath));
            CertificatePassword = certificatePassword;
        }

        public ValueTask<X509Certificate2> GetCertificateAsync(bool async, CancellationToken cancellationToken)
        {
            if (!(Certificate is null))
            {
                return new ValueTask<X509Certificate2>(Certificate);
            }

            // not compiled or cached because this should be a rare operation, and the source generator is not supported on all targets
            Regex certStorePathRegex = new(@"^cert:[\\/]{1,2}(\w+)[\\/](\w+)[\\/](\w+)$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);


Review comment (suggestion):
```suggestion
    /// X509Certificate2FromPathProvider provides an X509Certificate2 from "pfx"- and "pem"-encoded certificates
    /// on disk and the platform certificate store.
```

Code after:
﻿// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core;

namespace Azure.Identity
{
    /// <summary>
    /// X509Certificate2FromPathProvider provides an X509Certificate2 from "pfx"- and "pem"-encoded certificates
    /// on disk and the platform certificate store.
    /// </summary>
    internal sealed class X509Certificate2FromPathProvider : IX509Certificate2Provider
    {
        // Lazy initialized on the first call to GetCertificateAsync, based on CertificatePath.
        private X509Certificate2 Certificate { get; set; }
        internal string CertificatePath { get; }
        internal string CertificatePassword { get; }

        public X509Certificate2FromPathProvider(string clientCertificatePath, string certificatePassword)
        {
            Argument.AssertNotNull(clientCertificatePath, nameof(clientCertificatePath));
            CertificatePath = clientCertificatePath ?? throw new ArgumentNullException(nameof(clientCertificatePath));
            CertificatePassword = certificatePassword;
        }

        public ValueTask<X509Certificate2> GetCertificateAsync(bool async, CancellationToken cancellationToken)
        {
            if (!(Certificate is null))
            {
                return new ValueTask<X509Certificate2>(Certificate);
            }

            // not compiled or cached because this should be a rare operation, and the source generator is not supported on all targets
            Regex certStorePathRegex = new(@"^cert:[\\/]{1,2}(\w+)[\\/](\w+)[\\/](\w+)$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);