-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Register a callback that tries to load other versions Open LDAP library if the default is failed #88851
Conversation
…Dll event that tries to load other libraries
Tagging subscribers to this area: @dotnet/area-system-directoryservices, @jay98014 Issue DetailsRegister a callback that tries to load other versions of Open LDAP library if the default is failedOpen LDAP library version is hardcoded in runtime and used for native calls
From Ubuntu 22.04 only the new version of the library (libldap-2.5.so.0) is included in OS, so System.DirectoryServices.Protocols.LdapConnection fails to find the new version of the LDAP library as mentioned in the issue. @AaronRobinsonMSFT pointed out that we can register a callback to AssemblyLoadContext.Default.ResolvingUnmanagedll event. This event is raised if the native library could not be resolved via the default resolution logic. The PR doesn't include a specific test, I don't think I can test the logic added here specifically, let me know if you have a testing idea. Though all existing tests that connects to LDAP server would test this run the tests locally, all passes. (No CI test runs LDAP server so they are skipped in CI) Fixes #69456
|
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.DirectoryServices.Protocols/src/Resources/Strings.resx
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this @buyaa-n. Changes LGTM but I'll defer to @AaronRobinsonMSFT and @elinor-fung for what the best approach to hook to that event is.
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
Outdated
Show resolved
Hide resolved
39fa579
to
298469c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending question on patch versions
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
Outdated
Show resolved
Hide resolved
8b65ba2
to
4d776fd
Compare
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
Outdated
Show resolved
Hide resolved
Failures unrelated and known |
Register a callback that tries to load other versions of Open LDAP library if the default is failed
Open LDAP library version is hardcoded in runtime and used for native calls
runtime/src/libraries/Common/src/Interop/Linux/Interop.Libraries.cs
Line 9 in b12e288
From Ubuntu 22.04 only the new version of the library (libldap-2.5.so.0) is included in OS, so System.DirectoryServices.Protocols.LdapConnection fails to find the new version of the LDAP library as mentioned in the issue.
@AaronRobinsonMSFT pointed out that we can register a callback to AssemblyLoadContext.Default.ResolvingUnmanagedll event. This event is raised if the native library could not be resolved via the default resolution logic.
The PR doesn't include a specific test, I don't think I can test the logic added here specifically, let me know if you have a testing idea. Though all existing tests that connects to LDAP server would test this, run the tests locally on Ubuntu 22.04, after the fix all tests that require LDAP server passed. (No CI test runs LDAP server so they are skipped in CI)
Fixes #69456