CS8602 Dereference of a possibly null reference.

3 views
Skip to first unread message

Carlos Admirador

unread,
Dec 3, 2022, 1:55:00 AM12/3/22
to AltNet-Hispano
En VS2022, net5 aparece este warning:

Warning    CS8602    Dereference of a possibly null reference.    

Código:

//https://stackoverflow.com/questions/72211623/how-to-fix-remote-certificate-is-invalid-according-to-the-validation-procedure
            //https://stackoverflow.com/questions/9983265/the-remote-certificate-is-invalid-according-to-the-validation-procedure
            //ServicePointManager.ServerCertificateValidationCallback += (o, c, ch, er) => true;
            ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain,
        errors) =>
            {
                var hashString = certificate.GetCertHashString();
                if (hashString != null)
                {
                    var certHashString = hashString.ToLower();
                    return certHashString == "dec2b525ddeemma8ccfaa8df174455d6e38248c5";
                }
                //return false;
                return true;
            };



Warning afecta a la línea:

var hashString = certificate.GetCertHashString();

soluciones?
Reply all
Reply to author
Forward
0 new messages