Skip to content

Commit ec16bf6

Browse files
committed
Add test for MySql.Data bug 109476.
1 parent eedb08f commit ec16bf6

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

docs/content/tutorials/migrating-from-connector-net.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,3 +296,4 @@ The following bugs in Connector/NET are fixed by switching to MySqlConnector. (~
296296
* [#108756](https://bugs.mysql.com/bug.php?id=108756): Can't insert negative number using prepared statement with MySqlDbType.Int24]
297297
* [#108970](https://bugs.mysql.com/bug.php?id=108970): `MySqlConnectionStringBuilder.ContainsKey` method gives wrong result
298298
* [#109141](https://bugs.mysql.com/bug.php?id=109141): Insert of data into a table results in `System.ArgumentException`
299+
* [#109476](https://bugs.mysql.com/bug.php?id=109476): `TransactionScope.Dispose` throws "Connection must be valid and open to rollback"

tests/IntegrationTests/TransactionScopeTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,24 @@ public void CommitTwoTransactions()
683683
Assert.Equal(new[] { 3, 4 }, values2);
684684
}
685685

686+
[SkippableTheory(MySqlData = "https://bugs.mysql.com/bug.php?id=109476")]
687+
[MemberData(nameof(ConnectionStrings))]
688+
public void TransactionScopeNullReference(string connectionString)
689+
{
690+
// see https://bugs.mysql.com/bug.php?id=107110
691+
using var scope = new TransactionScope();
692+
using var connection = new MySqlConnection($"{AppConfig.ConnectionString};{connectionString}");
693+
connection.Open();
694+
695+
using var command = connection.CreateCommand();
696+
command.CommandText = "SELECT * from INFORMATION_SCHEMA.TABLES LIMIT 1; SELECT SLEEP(5);";
697+
command.CommandTimeout = 1;
698+
if (connection.ServerVersion.IndexOf("MariaDB") == -1)
699+
command.ExecuteNonQuery();
700+
else
701+
Assert.Throws<MySqlException>(() => command.ExecuteNonQuery());
702+
}
703+
686704
[SkippableFact(MySqlData = "Multiple simultaneous connections or connections with different connection strings inside the same transaction are not currently supported.")]
687705
public void RollBackTwoTransactions()
688706
{

0 commit comments

Comments
 (0)