We have server farm and recently have got really strange errors almost in the same time on the different servers in the farm. What we've got is ObjectDisposedException on the call to the SqlTransaction.Dispose. After several days of investigating we think that this is .NEt bug but caused by Sql Server. We didn't manage to reproduce the problem and only have a call stack. But even from the call stack it is obivious that this is bug.
Please have a look.
System.ObjectDisposedException: Safe handle has been closed
at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
at SNINativeMethodWrapper.SNIReadSync(SafeHandle pConn, IntPtr& packet, Int32 timeout)
at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command)
at System.Data.SqlClient.SqlInternalTransaction.Dispose(Boolean disposing)
at System.Data.SqlClient.SqlTransaction.Dispose(Boolean disposing)
.... <our code> ...
Dispose method was called just once and from the finally block.
At the same time we had several timeouts on the SQL server and probably most important thing that at the same time we had timeout on the database file autogrow operation.
So, IMHO there are 2 problems:
1. Exception should never be throws from the Dispose
2. Something that caused this problem