The default IEnumerable (also: IQueryable, IGrouping) comparer checks for referential rather than structural equality. This causes queries that output records with such elements as values to fail.
To reproduce the issue observe the comparison results of Q17 and Q42. Both queries' return values are tuples containing an IGrouping object which causes them to fail. On the other hand one can verify the result sets are the same by using a debugger.
Fixing this issue would require a custom comparer to check for element-wise equality between objects extending the IEnumerable type. This comparer must also recursively call itself in the case of nested types, such as tuples, lists, arrays or any such other custom type -- which seems infeasible.
The default
IEnumerable
(also:IQueryable
,IGrouping
) comparer checks for referential rather than structural equality. This causes queries that output records with such elements as values to fail.To reproduce the issue observe the comparison results of Q17 and Q42. Both queries' return values are tuples containing an
IGrouping
object which causes them to fail. On the other hand one can verify the result sets are the same by using a debugger.Fixing this issue would require a custom comparer to check for element-wise equality between objects extending the
IEnumerable
type. This comparer must also recursively call itself in the case of nested types, such as tuples, lists, arrays or any such other custom type -- which seems infeasible.