Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the implication of not using X509Store.Close method?

If I keep initializing X509Store certificate stores and don't use their Close() method, what is the implication of this?

In the code example given in documentation, they don't use try..finally block to make a call to Close method. If this certificate store is something that needs to be freed, why does not the API of the class designed to derive from IDisposable or why does not this class have a implicit destructor called when object goes out of scope?

like image 731
ahmet alp balkan Avatar asked Aug 27 '13 21:08

ahmet alp balkan


1 Answers

In .NET 4.6, X509Store was modified and now implementing IDisposable.

The Dispose implementation is calling the Close().

From Microsoft Docs:

Starting with the .NET Framework 4.6, this type implements the IDisposable interface. When you have finished using the type, you should dispose of it either directly or indirectly.

like image 82
Shay Avatar answered Nov 18 '22 17:11

Shay