diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Linux.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Linux.cs index b7bcca29c0ac26..dbedfdbc78cab6 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Linux.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Linux.cs @@ -9,7 +9,21 @@ public partial class LdapSessionOptions { private static void PALCertFreeCRLContext(IntPtr certPtr) { /* No op */ } - public bool SecureSocketLayer { get; set; } + private bool _secureSocketLayer; + + public bool SecureSocketLayer + { + get + { + if (_connection._disposed) throw new ObjectDisposedException(GetType().Name); + return _secureSocketLayer; + } + set + { + if (_connection._disposed) throw new ObjectDisposedException(GetType().Name); + _secureSocketLayer = value; + } + } public int ProtocolVersion { diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Windows.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Windows.cs index c587f4218a4ca6..14b8878a1c9cd1 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Windows.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Windows.cs @@ -9,7 +9,6 @@ public partial class LdapSessionOptions { private static void PALCertFreeCRLContext(IntPtr certPtr) => Interop.Ldap.CertFreeCRLContext(certPtr); - [SupportedOSPlatform("windows")] public bool SecureSocketLayer { get diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/LdapSessionOptionsTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/LdapSessionOptionsTests.cs index ef1436b750255f..77cdf83c49675e 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/LdapSessionOptionsTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/LdapSessionOptionsTests.cs @@ -64,7 +64,6 @@ public void SecureSocketLayer_Set_GetReturnsExpected(bool value) } [Fact] - [PlatformSpecific(TestPlatforms.Windows)] public void SecureSocketLayer_GetSetWhenDisposed_ThrowsObjectDisposedException() { var connection = new LdapConnection("server");