I get an InvalidOperationException when I try to add a row using LinqToSql. We cannot duplicate it in the house, and this is approximately 0.06% for one of our customers, always with a relatively simple change to the database. (Insert one row or update one field)
Message: This SqlTransaction has completed; it is no longer usable. Stack Trace: at System.Data.SqlClient.SqlTransaction.ZombieCheck() at System.Data.SqlClient.SqlTransaction.Rollback() at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
Here is a sample code (the database automatically generates a primary key)
TableName row = new TableName(); row.Description = "something"; row.Action = "action"; Context.TableName.InsertOnSubmit(row); Context.SubmitChanges();
We are using SQL Server 2008 R2. Insertions and updates are performed on the server. But we still get the exception. There is nothing to prevent these updates and insertions. No dependencies or other things.
How can we stop these exceptions / checks / rollbacks from zombies or that they cause them in the first place?
EDIT:
After additional verification, the database update performed by SubmitChanges () does indeed occur. This exception is thrown after the transaction is completed, and the database row is updated to the new value.
David source share