I'm working in C# pulling active directory groups for users. For some reason the app is throwing an error for one user on the following code snippet
PrincipalSearchResult<Principal> groups = user.GetGroups();
int total = groups.Count();
Error:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
I have never seen a Count()
method throw this kind of error before.