Got this error using a simple console application. After none of the above or any other solutions worked, I've changed the nuget package from System.DirectoryServices to System.DirectoryServices.Protocols, has a slighly different implementation (took example from co-pilot), but worked without any issues.