From: Alexander Köplinger Date: Wed, 19 Apr 2017 12:40:10 +0000 (+0200) Subject: [System.Data] Call SqlConnection.ClearAllPools() only when we had a connection X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=f11c25c42608d093e47bb2c3c638ae80b92d61ba;p=mono.git [System.Data] Call SqlConnection.ClearAllPools() only when we had a connection When ConnectionManager.Instance.Sql.ConnectionString throws in SetUp() we'd still call SqlConnection.ClearAllPools() in the TearDown() which happens for example when the connection string environment variable is not set. This is a problem on WatchOS since SqlConnection.ClearAllPools() throws PlatformNotSupportedException there, making the tests fail. Instead we now check whether the connectionString is set and only call the method in that case. --- diff --git a/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs b/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs index d894e18e0ac..0e060e9f857 100644 --- a/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs +++ b/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs @@ -60,7 +60,8 @@ namespace MonoTests.System.Data.Connected.SqlClient { if (conn != null) conn.Dispose (); - SqlConnection.ClearAllPools (); + if (connectionString != null) + SqlConnection.ClearAllPools (); } [Test]