We suffered a dreadful bug yesterday on only 1 or 6 servers running a WCF service in IIS. We got the "The maximum string content length quota (8192) has been exceeded while reading XML data". I eventually found the problem thanks to the Visual Studio highlighted reference colouring. I put the cursor on the bind object in code like this:
var bind = new NetNamedPipeBinding(); bind.MaxReceivedMessageSize = 4194304; bind.MaxBufferSize = 4194304; // etc Then I noticed the bind object wasn't even being used, so bind defaults were being used. So basically it was a case of "code blindness" where you can't proof read your own code. If I declare an "int x = 123" in the code above I'll get a warning, but not for the bind reference type. Compilers are really smart these days. Should the C# compiler warn that I was creating and preparing an object in local scope that was never used? Perhaps yes logically, but perhaps no because there could be desired side effects that only I know about. Hmmm. *Greg K*
