We're experiencing a strange situation where a LinqToSQL that has compiled queries within it causes a stackoverflow exception when ran locally but when in a live environment runs fine without any issues.
The query contains a number of joins and on the select calls 2 different compiled queries to calculate a couple of values. If we comment these queries out then the query runs fine. It doesn't seem to be a specific compiled query either as just running a single one causes the issue.
The point at which the debugger breaks for the exception is no help either as it's a line of code that had nothing to do with the query being executed.
This happened to me today. I switched to Visual Studio 2015 from 2103 and compiled a library without recompiling its dependencies. In my case, it looked like a compiler problem.
A clean and a rebuild (dependencies included) solved the problem.