Bug #90280 NullReferenceException thrown on TransactionScope dispose

Submitted: 2 Apr 2018 15:56 Modified: 13 Mar 2024 16:57
Reporter: Daniel Valdez Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.9.11 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[2 Apr 2018 15:56] Daniel Valdez
Description:
Exception thrown on dispose of TransactionScope.

- There is already a bug (https://bugs.mysql.com/bug.php?id=59346) created and closed for this issue but the problem is appearing again. 

How to repeat:
1) Before running, lock tables t2 read

2) 
        private void btnTestTransactionScope_Click(object sender, EventArgs e)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                DoInsertTablet1();
                DoInsertTablet2(); //X
                scope.Complete();
            }            
        }

        //DoInsertTable2 is similar except for the table name
        private static void DoInsertTable1()
        {

            try
            {
                using (MySqlConnection conn = new MySqlConnection(GetTestDBConn()))
                using (MySqlCommand cmd = conn.CreateCommand())
                {
                    conn.Open();
                    cmd.CommandText = @"insert into t2 (Val) values (?value)";
                    cmd.CommandTimeout = 5;
                    cmd.Parameters.AddWithValue("?value", new Random().Next());
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception)
            {
             //throw (my custom exception that will be processed in BL layer)
            }
        }
[13 Mar 2024 16:57] Filipe Silva
Duplicated by Bug#107110.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.