diff --git a/src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs b/src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
index 9b0095aacc8ddc..eedeefc3ffa99d 100644
--- a/src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
+++ b/src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
@@ -74,21 +74,19 @@ static Ldap()
// Register callback that tries to load other libraries when the default library "libldap-2.5.so.0" not found
AssemblyLoadContext.GetLoadContext(currentAssembly).ResolvingUnmanagedDll += (assembly, ldapName) =>
{
- IntPtr handle = IntPtr.Zero;
-
if (assembly != currentAssembly || ldapName != Libraries.OpenLdap)
{
- return handle;
+ return IntPtr.Zero;
}
// Try loading previous (libldap-2.4.so.2) and next (libldap-2.6.so.0) versions
- if (NativeLibrary.TryLoad("libldap-2.4.so.2", out handle) ||
+ if (NativeLibrary.TryLoad("libldap-2.4.so.2", out IntPtr handle) ||
NativeLibrary.TryLoad("libldap-2.6.so.0", out handle))
{
return handle;
}
- throw new DllNotFoundException(SR.Format(SR.LDAP_LIBRARY_NOT_FOUND, ldapName));
+ return IntPtr.Zero;
};
// OpenLdap must be initialized on a single thread, once this is done it allows concurrent calls
diff --git a/src/libraries/System.DirectoryServices.Protocols/src/Resources/Strings.resx b/src/libraries/System.DirectoryServices.Protocols/src/Resources/Strings.resx
index 7b1c63e529b6ca..b63f103619fbdb 100644
--- a/src/libraries/System.DirectoryServices.Protocols/src/Resources/Strings.resx
+++ b/src/libraries/System.DirectoryServices.Protocols/src/Resources/Strings.resx
@@ -426,7 +426,4 @@
Only ReferralChasingOptions.None and ReferralChasingOptions.All are supported on Linux.
-
- The OpenLDAP library with version {0} was not found.
-
\ No newline at end of file