Which Version of MSAL are you using ?
4.10
Platform
netcore (did not test net45, probably the same)
What authentication flow has the issue?
Client Creds
Repro
var certWithNoPrivateKey = new X509Certificate2("path/to/cert.cer");
var cca = // create CCA with certificate
await cca.AcquireTokenForClient(scopes).ExecuteAsync();
Expected behavior
A nice exception telling me to use a certificate that can be used for signing.
Actual behavior
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Microsoft.Identity.Client
StackTrace:
at Microsoft.Identity.Client.Platforms.netcore.NetCoreCryptographyManager.SignWithCertificate(String message, X509Certificate2 certificate) in C:\g\msal\src\client\Microsoft.Identity.Client\Platforms\netcore\NetCoreCryptographyManager.cs:line 70
Possible Solution
Before signing, check if certificate has private key. If there isn't a private key, throw a nice exception.