.Net SqlClient sometimes throws a General Network Error during a DataAdapter.Fill or DataReader.Read. This is starting to become extremely annoying. Several other people are having troubles with it so I know it’s not just me (post #1, post #2, post #3). The question remains wtf is going on.
I’ve checked the code inside of the SqlClient classes using Remotesoft’s .NET Explorer and it seems the the Fill method dies during a ReadString call in the ProcessMetaData method. ReadString is used to read a column value from the Connection. So it looks like the data is not avalible. btw: ReadString calls ReadByteArray, which in turns calls ReadBuffer. Now ReadBuffer starts to looks dangerous, not only is there code to handle buffer wrap around, but it calls the ReadNetlib. I’m not sure which inBytesPacket it ends up jumping into, but ReadNetlib either expects 1 or 8 bytes. ReadNetlib calls the dbnetlib call which is obviously the jump out to unmanaged space.
I’ve even seen this General Network Error problem coming up [in google] even for raw dbnetlib code.
I can only think to catch this exception better and try and pull some of the more specific SQLException details to display them.