```cs
currentUsers.GroupBy(user => user.ID)
            .Where(group => group.Count() > 1)
            .ToDictionary(group => group.Key, group => group.ToList()
            .AsEnumerable());

```

Tried to find duplicates by using `GroupBy` on the readonly collection but it throws null reference exception:

> 
> Object not set to an instance of the object
> 
> 
> 

Tried converting the readonly collection to list , but it still throws the same exception.The linq query works fine in immediate window in Visual Studio 2017 but fails during runtime and debugging. Could someone please help?