Open AnthonyMastrean opened 3 years ago
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
A related issue #54274 discusses adding some of the same state tracking I was thinking about.
Description
It's obvious that we should always dispose of an
LdapConnection
instance via ausing
statement (or similar).To use LDAP with TLS, we're supposed to call the relevant "start" method on the session options instance. I assume, but it's not documented, that we should attempt to stop TLS if we started it. I'm thinking a
try
...finally
block?However, if, for whatever reason, it's the start method call that fails leading to the stop method call in the finally block, the stop method will throw a
TlsOperationException
, which is documented. But, that means, I need to either wrap that call or track a local Boolean.This is kind of a hot mess, right? Is there any way to get a
bool
returned by the start/stop methods? or for the session options to track this state like it does for "secure socket layer" (if that is, in fact, what is happening there)?Configuration
.NET 5.0 on Windows 10 and Debian Linux.
Regression?
Other information