I am building generic linq query using expression tree. I am stuck when creating expression on child collection. Method call blows up because of incompatible types. Normally I know what to put there, but the Any() method call has me confused. I've tried every type I can think of and no luck. Any help would be appreciated.

But after running this code, I get this error which I am not able to resolve

No generic method 'Any' on type 'System.Linq.Queryable' is compatible
with the supplied type arguments and arguments. No type arguments
should be provided if the method is non-generic. Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.

Exception Details: System.InvalidOperationException: No generic method
'Any' on type 'System.Linq.Queryable' is compatible with the supplied
type arguments and arguments. No type arguments should be provided if
the method is non-generic.

Also you should have created one p parameter (Expression.Parameter(query.ElementType, "p")) otherwise you'll get variable 'p' of type 'WpfApplication2.Story' referenced from scope '', but it is not defined error.