GuyBehindtheGuy (2) [Avatar] Offline
The implementation of
IQueryProvider.CreateQuery(Expression expression)
on page 329 is dangerous and wrong. It constructs and returns an IQueryable<object>, disregarding Expression.Type. It is also in stark contrast to Microsoft's recommended implementation:

This just cost us several days to track down, because it insidiously causes the IQueryProvider implementation to return different results depending on if the generic vs. non-generic CreateQuery method is called.

While I understand that the full (and correct) implementation of CreateQuery may not have fit the spirit of the example (a simple IQueryProvider implementation), there needs to be a comment next to it akin to:
// Don't do this in production code!
jon.skeet (483) [Avatar] Offline
Re: IQueryProvider implementation
Thanks for that - I'm just starting to work on revising chapter 12. Will fix this as I go.

Also added a note:
GuyBehindtheGuy (2) [Avatar] Offline
Re: IQueryProvider implementation
BTW--the book is great, and I recommend it to everyone who interviews with us!