
GroupBy InvalidOperationException
This exception is thrown when a column value is null in a GroupBy query that groups by a boolean expression, such as group x by (Phone==@phone). Because the expression is a boolean, the key is inferred to be boolean, not nullable boolean. When the translated comparison produces a null, an attempt is made to assign a nullable boolean to a boolean, and the exception is thrown.
To avoid this situation (assuming you want to treat nulls as false), use an approach such as the following:
GroupBy="(Phone != null) && (Phone=@Phone)"