BUG: SqlDataReader does not propagate deadlock exceptions in SqlClient (316667)
The information in this article applies to:
- Microsoft ADO.NET (included with the .NET Framework)
- Microsoft ADO.NET (included with the .NET Framework 1.1)
This article was previously published under Q316667 This article refers to the following Microsoft .NET
Framework Class Library namespaces:
- System.Threading
- System.Data
- System.Data.SqlClient
- System.Diagnostics
SYMPTOMS When you execute the SqlTransaction.ExecuteReader function within a repeatable read transaction, the transaction is
blocked and then aborted due to a deadlock. When a repeatable read transaction
is blocked by a deadlock, SqlTransaction.ExecuteReader may throw incorrect exceptions and, in some situations, may
return with an empty reader. Here is an example of an unexpected
error message that you may receive: The COMMIT
TRANSACTION request has no corresponding BEGIN TRANSACTION. The
expected error message, both for incorrect exceptions and for an empty reader,
is as follows: Transaction (Process ID XX) was
deadlocked on lock resources with another process and has been chosen as the
deadlock victim. Rerun the transaction. RESOLUTION When you use SqlTransaction.SqlExecuteReader, always follow it with a call to SqlDataReader.Read followed by SqlDataReader.NextResult to see the error. It is especially important to capture the error
situation that produces an empty reader. To advance to the next result, call
the DataReader.NextResult method as demonstrated below. STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
REFERENCESFor additional information, click the
article numbers below to view the articles in the Microsoft Knowledge Base: 315965 HOW TO: Use Structured Exception Handling in Visual Basic .NET
311326 INFO: Error Handling in Visual Basic .NET
Modification Type: | Minor | Last Reviewed: | 3/10/2006 |
---|
Keywords: | kbbug kbnofix kbSqlClient kbSystemData KB316667 |
---|
|