Open michaelmcdaniel opened 6 years ago
@michaelmcdaniel, thanks for your feedback. @bartonjs, the .NET Framework 4 documentation on docs.microsoft.com (but not on MSDN) includes Dispose as inherited from X509Certificate. Can you confirm when IDisposable was first added?
IDisposable
was added to X509Certificate
for .NET Framework 4.6.
Since it's an in-place upgrade with prior 4.x releases, a runtime check will say that it's IDisposable, but at compile-time it can only be used in a using
statement when targeting 4.6 or higher.
So, the existing comments are correct, from a compile-time perspective; but a runtime as
cares about what version was installed, not what version the compile target was.
I have code that iterates an array of objects that dispose objects that implement IDisposable. In .net 4.5.2, the certificates do in fact get disposed and all references become invalid. I did not check prior versions. The remarks for this class are wrong/misleading and need to be updated.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.