Closed
Description
Description
Commit d15adf0 broken DirectorySynchronization in DirectorySearch by following change in DirectorySearch.cs:
/// FROM
SearchResultCollection result = new SearchResultCollection(clonedRoot, resultsHandle, properties, this);
searchResult = result; /// !!!REMOVED!!!
return result;
/// TO
return new SearchResultCollection(clonedRoot, resultsHandle, properties, this);
searchResult is not cached now and because of that the directory synchronization cookie is not updated.
Reproduction Steps
var ds = new DirectorySearcher("LDAP://srv-dc/dc=domain,dc=local");
ds.Filter = "(|(&(objectCategory=person)(objectClass=user))(&(objectClass=group)(!(groupType:1.2.840.113556.1.4.803:=2147483648)))(isDeleted=*))";
ds.DirectorySynchronization = new DirectorySynchronization();
ds.Tombstone = true;
ds.PropertiesToLoad.Add("objectGUID");
ds.PropertiesToLoad.Add("isDeleted");
ds.PropertiesToLoad.Add("objectClass");
ds.PropertiesToLoad.Add("member");
ds.PropertiesToLoad.Add("mail");
ds.PropertiesToLoad.Add("name");
var res1 = ds.FindAll();
var res2 = ds.FindAll();
Expected behavior
res2 should be empty
Actual behavior
res2 is identical to res1
Regression?
Commit d15adf0 introduced regression.
Known Workarounds
Set searchResult private field after search via reflection, I assume.
Configuration
NET 6.0
Windows 10 22H2
x64