Hi @Peter Volz ,
You could catch CryptographicException
for certificate-related issues.
Using the following code to dispose the resources.
For Each cert As X509Certificate2 In Temp509Collection
cert.Reset()
Next
Temp509Collection.Clear()
Best Regards.
Jiachen Li
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.