Simple example - you have a method or a property that returns an IEnumerable and the caller is iterating over that in a foreach() loop. Should you always be using
Without reading through answers I will tell you that using yield in a WCF service will mess up your FaultException!
It took me quite some time to find out that yield was the culprit. I just needed a fast way too get som errors up n running. The proper way would of course be to include an Error object in the reply but I needed it fast. I did : throw new FaultException("No subscription with id: " + subscriptionId.ToString());
But using yield, even below the actuall throwing, caused a regular exception, network