I have a long running process that needs to do a lot of queries on Active Directory quite often. For this purpose I have been using the System.DirectoryServices namespace, u
Found a quick and dirty way around this.
I had a similar issue in my program with memory growth but by changing .GetDirectoryEntry().Properties("cn").Value to
.GetDirectoryEntry().Properties("cn").Value.ToString with a if before hand to make sure .value was not null
i was able to tell GC.Collect to get rid of the temporary value in my foreach. It looks like the .value was actually keeping the object alive rather then allowing it to be collected.