Issue Details (XML | Word | Printable)

Key: DNET-619
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jiri Cincura
Reporter: Alex Gaysinskiy
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
.NET Data provider

Possible incorrect usage of WeakReference.Target in method FirebirdSql.Data.FirebirdClient.FbConnectionInternal.TransactionUpdated

Created: 01/Jul/15 09:39 AM   Updated: 03/Jul/15 03:30 PM
Component/s: None
Affects Version/s:,
Fix Version/s:

Environment: Windows 7 prof, sp1, CPU i5-3550, mem 8 GiB
Issue Links:

 Description  « Hide
Implementation of FirebirdSql.Data.FirebirdClient.FbConnectionInternal.TransactionUpdated function (FirebirdClient\FbConnectionInternal.cs, line 298) has incorrect condition:

                public void TransactionUpdated()
for (int i = 0; i < this.preparedCommands.Count; i++)
if (!this.preparedCommands[i].IsAlive) //<<<= This check does nothing. Between this line and the following can happen garbage collection.

FbCommand command = this.preparedCommands[i].Target as FbCommand; //<<<= may be a null

if (command.Transaction != null) //<<<= potential NRE. Correct code is: command != null && command.Transaction != null
command.Transaction = null;

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jiri Cincura added a comment - 02/Jul/15 03:50 PM - edited
Sure it is, thanks. Looks like the DNET-617 is related. I'll investigate.