This MSDN article states that X509Store
class implements IDisposable
in .NET 4.5. This was not the case in earlier versions of .NET.
Even though I have Windows 8.1, Visual Studio 2013, all .Net versions installed, from 2.0 to 4.5.1, I can only see X509Store
that looks like .NET 4 version in latest System.dll (v4.0.30319, aka .NET 4.5). VS Object Browser also shows that X509Store
in System.dll v4.0.30319 does not implement IDisposable
like MSDN article says it should.
What am I missing and how do I get X509Store
from .NET 4.5? Is MSDN wrong? It would not be the first time, but still. Is there an obscure Windows Update KB fix for it?
At first sight, it looks like that MSDN says the half-truth: Microsoft added IDisposable
interface to the X509Store
class only in 4.6 version, not earlier. You can easily check it by using this really useful diff list between 4.5.2 and 4.6 versions: NET 4.5.2 vs 4.6 - System.Security.Cryptography.X509Certificates namespace.
But at the current moment the MSDN article has the following sentence in the "Remarks" section:
For apps that target the .NET Framework 4.5.2 and earlier versions, the X509Store class does not implement the IDisposable interface and therefore does not have a Dispose method.