Linq to SQL throwing a StackOverflowException
I'm executing a pretty simple query using Linq to SQL. I'm creating the expression and then passing it to the Where() extension method. The Linq internals are throwing a StackOverflowException when I attempt to actually execute the query. Here is the code: int expectedCount = 4; Expression<Func<Thing, bool>> expression = ...; //Expression looks like (LocaleID = 1 && GenderID ==1 && (TimeFrameID == 2007 || TimeFrameID == 2008)) using (XYZDataContext context = new XYZDataContext()) { int count = context.Things.Where(expression).Count(); //... } And here is the DebugView of the expression: