From 0b0930a8c04153a579cf87152e2b2d71fe88ffd3 Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Thu, 14 Jan 2021 16:01:37 -0800 Subject: [PATCH 01/23] net5 compatibility --- .../tests/FunctionalTests/SqlExceptionTest.cs | 22 ------------------- .../AlwaysEncrypted/ConversionTests.cs | 9 ++++---- .../TestFixtures/SQLSetupStrategy.cs | 5 ++++- .../ManualTests/SQL/Common/AsyncDebugScope.cs | 2 ++ .../ConnectivityTests/AADConnectionTest.cs | 6 +++-- .../SQL/ConnectivityTests/ConnectivityTest.cs | 7 +++++- .../SQL/DataStreamTest/DataStreamTest.cs | 5 +++-- .../SQL/RandomStressTest/RandomStressTest.cs | 7 +++++- .../SQL/RandomStressTest/Randomizer.cs | 11 ++++++---- .../SQL/RandomStressTest/RandomizerPool.cs | 19 +++++++++++----- 10 files changed, 50 insertions(+), 43 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs index 97cd1909ab..3eacc8accb 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs @@ -33,28 +33,6 @@ public void SerializationTest() Assert.Equal(e.StackTrace, sqlEx.StackTrace); } - - [Fact] - [ActiveIssue("12161", TestPlatforms.AnyUnix)] - public static void SqlExcpetionSerializationTest() - { - var formatter = new BinaryFormatter(); - SqlException e = CreateException(); - using (var stream = new MemoryStream()) - { - try - { - formatter.Serialize(stream, e); - stream.Position = 0; - var e2 = (SqlException)formatter.Deserialize(stream); - } - catch (Exception ex) - { - Assert.False(true, $"Unexpected Exception occurred: {ex.Message}"); - } - } - } - [Fact] public void JSONSerializationTest() { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ConversionTests.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ConversionTests.cs index eb55710bcd..661b9f9c9a 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ConversionTests.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ConversionTests.cs @@ -64,7 +64,7 @@ public ConversionTests() certStoreProvider); databaseObjects.Add(columnEncryptionKey); - foreach(string connectionStr in DataTestUtility.AEConnStringsSetup) + foreach (string connectionStr in DataTestUtility.AEConnStringsSetup) { using (SqlConnection sqlConnection = new SqlConnection(connectionStr)) { @@ -1343,7 +1343,7 @@ private void SetParamSizeScalePrecision(ref SqlParameter param, ColumnMetaData c public void Dispose() { databaseObjects.Reverse(); - foreach(string connectionStr in DataTestUtility.AEConnStringsSetup) + foreach (string connectionStr in DataTestUtility.AEConnStringsSetup) { using (SqlConnection sqlConnection = new SqlConnection(connectionStr)) { @@ -1351,6 +1351,7 @@ public void Dispose() databaseObjects.ForEach(o => o.Drop(sqlConnection)); } } + certificate?.Dispose(); } } @@ -1426,14 +1427,14 @@ public IEnumerator GetEnumerator() yield return new object[] { connStrAE, SqlDbType.DateTime2, SqlDbType.DateTime2 }; yield return new object[] { connStrAE, SqlDbType.DateTimeOffset, SqlDbType.DateTimeOffset }; yield return new object[] { connStrAE, SqlDbType.Float, SqlDbType.Float }; - yield return new object[] { connStrAE, SqlDbType.Real, SqlDbType.Real}; + yield return new object[] { connStrAE, SqlDbType.Real, SqlDbType.Real }; } } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } - + public class TestOutOfRangeValuesData : IEnumerable { public IEnumerator GetEnumerator() diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs index 7183655c41..8be4808171 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs @@ -252,6 +252,7 @@ public void Dispose() databaseObjects.ForEach(o => o.Drop(sqlConnection)); } } + certificate?.Dispose(); } } @@ -277,7 +278,9 @@ public PlatformSpecificTestContext() public void Dispose() { - Fixture.Dispose(); + akvFixture?.Dispose(); + certStoreFixture?.Dispose(); + Fixture?.Dispose(); } } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/Common/AsyncDebugScope.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/Common/AsyncDebugScope.cs index fc4c312123..06ba6edcb8 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/Common/AsyncDebugScope.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/Common/AsyncDebugScope.cs @@ -101,6 +101,8 @@ public void Dispose() _command.CompletePendingReadWithSuccess(true); } } + _reader.Dispose(); + _command.Dispose(); } } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs index d823c05b87..f906168cd8 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs @@ -202,9 +202,11 @@ public static void testADPasswordAuthentication() } } } - catch (SqlException e) + catch (SqlException) { - throw e; + // re-throwing exception in here will change the stack. + // we just throw caught exception. + throw; } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/ConnectivityTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/ConnectivityTest.cs index 3e338a3b1e..85f4f94917 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/ConnectivityTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/ConnectivityTest.cs @@ -146,7 +146,7 @@ public static void LocalProcessIdTest() } } } - public class ConnectionWorker + public class ConnectionWorker : IDisposable { private static List workerList = new List(); private ManualResetEventSlim _doneEvent = new ManualResetEventSlim(false); @@ -183,6 +183,11 @@ public static void Stop() } } + public void Dispose() + { + _doneEvent.Dispose(); + } + public void SqlConnectionOpen() { Stopwatch sw = new Stopwatch(); diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs index 2dc5dfcb89..6f3d72507b 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs @@ -2009,11 +2009,12 @@ private static void TimeoutDuringReadAsyncWithClosedReaderTest(string connection } proxy.Stop(); } - catch (SqlException ex) + catch (SqlException) { // In case of error, stop the proxy and dump its logs (hopefully this will help with debugging + // re-throwing exception will change the stack. we just throw the caught exception. proxy.Stop(); - throw ex; + throw; } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/RandomStressTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/RandomStressTest.cs index 75b2a55119..3bed4b5e12 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/RandomStressTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/RandomStressTest.cs @@ -12,7 +12,7 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests { - public class RandomStressTest + public class RandomStressTest : IDisposable { private static readonly TimeSpan TimeLimitDefault = new TimeSpan(0, 0, 10); private const int ThreadCountDefault = 4; @@ -359,6 +359,11 @@ private void RunTestIteration(SqlConnection con, SqlRandomizer rand, SqlRandomTa } } } + + public void Dispose() + { + _endEvent?.Dispose(); + } } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/Randomizer.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/Randomizer.cs index b057ae812c..2f158fddd5 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/Randomizer.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/Randomizer.cs @@ -237,18 +237,21 @@ protected static int DeserializeInt(byte[] buf, ref int offset) return unchecked((int)uval); } + //this method is only used for Randomizer constructor to avoid using overridable method inside constructor. + private void DeserializeInitializer() + { + string base64State = GetCurrentState().ToString(); + Deserialize(Convert.FromBase64String(base64State), out _); + } /// /// deserialization constructor /// public Randomizer(StreamingContext context) { - string base64State = GetCurrentState().ToString(); - int offset; - Deserialize(Convert.FromBase64String(base64State), out offset); + DeserializeInitializer(); } - /// /// use this method to create seeds for nested randomizers out of current one /// diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/RandomizerPool.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/RandomizerPool.cs index 84593e2597..341f74bdf8 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/RandomizerPool.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/RandomizerPool.cs @@ -271,12 +271,11 @@ Randomizer.State[] IScope.GetStates() Randomizer IScope.Current { get { return Current; } } - /// - /// Disposes the scope and reverts the current thread scope to previous one. - /// Note that the "last created scope" is not changed on Dispose, thus the scope instance - /// itself can still be used to collect repro states. - /// - public void Dispose() + // reverts the current thread scope to previous one + // This method is only used inside Dispose method. + // Note that the "last created scope" is not changed on Dispose, thus the scope instance. + // itself can still be used to collect repro states. + private void CheckCurrentRandomizerState() { if (_current != null) { @@ -293,6 +292,14 @@ public void Dispose() } } + /// + /// Disposes the scope. + /// + public void Dispose() + { + CheckCurrentRandomizerState(); + } + /// /// creates a new scope with Randomizer type or derived /// From cb50754ca423be4ee22af0519d481ce224bd1125 Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Sun, 17 Jan 2021 22:42:17 -0800 Subject: [PATCH 02/23] update --- .../ExceptionsAlgorithmErrors.cs | 2 +- .../TestFixtures/SQLSetupStrategy.cs | 2 +- .../ConnectivityTests/AADConnectionTest.cs | 2 +- .../SqlNotificationTest.cs | 23 ++++++++++--------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/ExceptionsAlgorithmErrors.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/ExceptionsAlgorithmErrors.cs index c273534045..9e727d5697 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/ExceptionsAlgorithmErrors.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/ExceptionsAlgorithmErrors.cs @@ -195,7 +195,7 @@ public void TestExceptionsFromCertStore() public void TestExceptionsFromCustomKeyStore() { string[] errorMessages = { - string.Format("Failed to decrypt a column encryption key using key store provider: 'DummyProvider'. Verify the properties of the column encryption key and its column master key in your database. The last 10 bytes of the encrypted column encryption key are: '{0}'.\r\nThe method or operation is not implemented.", BitConverter.ToString(CertFixture.encryptedCek, CertFixture.encryptedCek.Length-10, 10)), + string.Format("Failed to decrypt a column encryption key. Invalid key store provider name: 'DummyProvider'. Verify the properties of the column encryption key and its column master key in your database. The last 10 bytes of the encrypted column encryption key are: '{0}'.\r\nThe method or operation is not implemented.", BitConverter.ToString(CertFixture.encryptedCek, CertFixture.encryptedCek.Length-10, 10)), string.Format("The method or operation is not implemented.") }; diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs index 8be4808171..9e822146b2 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs @@ -278,9 +278,9 @@ public PlatformSpecificTestContext() public void Dispose() { + //Fixture?.Dispose(); akvFixture?.Dispose(); certStoreFixture?.Dispose(); - Fixture?.Dispose(); } } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs index f906168cd8..9e459a7796 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs @@ -202,7 +202,7 @@ public static void testADPasswordAuthentication() } } } - catch (SqlException) + catch { // re-throwing exception in here will change the stack. // we just throw caught exception. diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs index c8b42a052f..57106a3d39 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs @@ -11,7 +11,7 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests public class SqlNotificationTest : IDisposable { // Misc constants - private const int CALLBACK_TIMEOUT = 5000; // milliseconds + private const int CALLBACK_TIMEOUT = 6000; // milliseconds // Database schema private readonly string _tableName = $"dbo.[SQLDEP_{Guid.NewGuid().ToString()}]"; @@ -146,8 +146,8 @@ public void Test_SingleDependency_AllDefaults_SqlAuth() try { // create a new event every time to avoid mixing notification callbacks - ManualResetEvent notificationReceived = new ManualResetEvent(false); - ManualResetEvent updateCompleted = new ManualResetEvent(false); + ManualResetEventSlim notificationReceived = new ManualResetEventSlim(false); + ManualResetEventSlim updateCompleted = new ManualResetEventSlim(false); using (SqlConnection conn = new SqlConnection(_execConnectionString)) using (SqlCommand cmd = new SqlCommand("SELECT a, b, c FROM " + _tableName, conn)) @@ -157,7 +157,7 @@ public void Test_SingleDependency_AllDefaults_SqlAuth() SqlDependency dep = new SqlDependency(cmd); dep.OnChange += delegate (object o, SqlNotificationEventArgs arg) { - Assert.True(updateCompleted.WaitOne(CALLBACK_TIMEOUT, false), "Received notification, but update did not complete."); + Assert.True(updateCompleted.Wait(CALLBACK_TIMEOUT), "Received notification, but update did not complete."); DataTestUtility.AssertEqualsWithDescription(SqlNotificationType.Change, arg.Type, "Unexpected Type value."); DataTestUtility.AssertEqualsWithDescription(SqlNotificationInfo.Update, arg.Info, "Unexpected Info value."); @@ -174,7 +174,8 @@ public void Test_SingleDependency_AllDefaults_SqlAuth() updateCompleted.Set(); - Assert.True(notificationReceived.WaitOne(CALLBACK_TIMEOUT, false), "Notification not received within the timeout period"); + Assert.True(notificationReceived.Wait(CALLBACK_TIMEOUT), "Notification not received within the timeout period"); + notificationReceived.Reset(); } finally { @@ -190,8 +191,8 @@ public void Test_SingleDependency_CustomQueue_SqlAuth() try { // create a new event every time to avoid mixing notification callbacks - ManualResetEvent notificationReceived = new ManualResetEvent(false); - ManualResetEvent updateCompleted = new ManualResetEvent(false); + ManualResetEventSlim notificationReceived = new ManualResetEventSlim(false); + ManualResetEventSlim updateCompleted = new ManualResetEventSlim(false); using (SqlConnection conn = new SqlConnection(_execConnectionString)) using (SqlCommand cmd = new SqlCommand("SELECT a, b, c FROM " + _tableName, conn)) @@ -201,7 +202,7 @@ public void Test_SingleDependency_CustomQueue_SqlAuth() SqlDependency dep = new SqlDependency(cmd, "service=" + _serviceName + ";local database=msdb", 0); dep.OnChange += delegate (object o, SqlNotificationEventArgs args) { - Assert.True(updateCompleted.WaitOne(CALLBACK_TIMEOUT, false), "Received notification, but update did not complete."); + Assert.True(updateCompleted.Wait(CALLBACK_TIMEOUT), "Received notification, but update did not complete."); Console.WriteLine("7 Notification callback. Type={0}, Info={1}, Source={2}", args.Type, args.Info, args.Source); notificationReceived.Set(); @@ -215,7 +216,7 @@ public void Test_SingleDependency_CustomQueue_SqlAuth() updateCompleted.Set(); - Assert.False(notificationReceived.WaitOne(CALLBACK_TIMEOUT, false), "Notification should not be received."); + Assert.False(notificationReceived.Wait(CALLBACK_TIMEOUT), "Notification should not be received."); } finally { @@ -241,7 +242,7 @@ public void Test_SingleDependency_Timeout() const int maxTimeoutEventInterval = testTimeSeconds + SqlDependencyTimerResolution + 1; // create a new event every time to avoid mixing notification callbacks - ManualResetEvent notificationReceived = new ManualResetEvent(false); + ManualResetEventSlim notificationReceived = new ManualResetEventSlim(false); DateTime startUtcTime; using (SqlConnection conn = new SqlConnection(_execConnectionString)) @@ -272,7 +273,7 @@ public void Test_SingleDependency_Timeout() } Assert.True( - notificationReceived.WaitOne(TimeSpan.FromSeconds(maxTimeoutEventInterval), false), + notificationReceived.Wait(TimeSpan.FromSeconds(maxTimeoutEventInterval)), string.Format("Notification not received within the maximum timeout period of {0} seconds", maxTimeoutEventInterval)); // notification received in time, check that it is not too early From f1bac2fcb613c569dc306a6039d600880d98c9de Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Sun, 17 Jan 2021 22:57:22 -0800 Subject: [PATCH 03/23] error message --- .../AlwaysEncryptedTests/ExceptionsAlgorithmErrors.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/ExceptionsAlgorithmErrors.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/ExceptionsAlgorithmErrors.cs index 9e727d5697..c273534045 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/ExceptionsAlgorithmErrors.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/ExceptionsAlgorithmErrors.cs @@ -195,7 +195,7 @@ public void TestExceptionsFromCertStore() public void TestExceptionsFromCustomKeyStore() { string[] errorMessages = { - string.Format("Failed to decrypt a column encryption key. Invalid key store provider name: 'DummyProvider'. Verify the properties of the column encryption key and its column master key in your database. The last 10 bytes of the encrypted column encryption key are: '{0}'.\r\nThe method or operation is not implemented.", BitConverter.ToString(CertFixture.encryptedCek, CertFixture.encryptedCek.Length-10, 10)), + string.Format("Failed to decrypt a column encryption key using key store provider: 'DummyProvider'. Verify the properties of the column encryption key and its column master key in your database. The last 10 bytes of the encrypted column encryption key are: '{0}'.\r\nThe method or operation is not implemented.", BitConverter.ToString(CertFixture.encryptedCek, CertFixture.encryptedCek.Length-10, 10)), string.Format("The method or operation is not implemented.") }; From 96d18dd9f461cc72101b6cedd291d68d68e8ebf6 Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Fri, 22 Jan 2021 14:26:28 -0800 Subject: [PATCH 04/23] change targetframework --- .../Microsoft.Data.SqlClient.ExtUtilities.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj index 614ab2d91e..afcb0c6d63 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj +++ b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj @@ -1,7 +1,7 @@  Exe - netcoreapp3.1 + net5.0 Microsoft.Data.SqlClient.ExtUtilities.Runner From c4d8a8fc5c41db9bf8bf2216412e6e78417ec2f6 Mon Sep 17 00:00:00 2001 From: Javad Rahnama Date: Mon, 25 Jan 2021 23:41:35 -0800 Subject: [PATCH 05/23] pipeline for net5 --- .../Microsoft.Data.SqlClient.ExtUtilities.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj index afcb0c6d63..acc0a64d6e 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj +++ b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj @@ -1,7 +1,7 @@  Exe - net5.0 + ;netcoreapp3.1;net5.0 Microsoft.Data.SqlClient.ExtUtilities.Runner From 87426a3f5856f90287e7d0f9b55476d07c2d723f Mon Sep 17 00:00:00 2001 From: Javad Rahnama Date: Mon, 25 Jan 2021 23:43:59 -0800 Subject: [PATCH 06/23] fix --- .../Microsoft.Data.SqlClient.ExtUtilities.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj index acc0a64d6e..a545d8e533 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj +++ b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities/Microsoft.Data.SqlClient.ExtUtilities.csproj @@ -1,7 +1,7 @@  Exe - ;netcoreapp3.1;net5.0 + netcoreapp3.1;net5.0 Microsoft.Data.SqlClient.ExtUtilities.Runner From a2ef94949b47f94443683fd112f8d936378fd09e Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Tue, 2 Feb 2021 10:50:03 -0800 Subject: [PATCH 07/23] BinaryFormatter Test --- .../tests/FunctionalTests/SqlExceptionTest.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs index 3eacc8accb..eb1678c9f4 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs @@ -33,6 +33,29 @@ public void SerializationTest() Assert.Equal(e.StackTrace, sqlEx.StackTrace); } +#if !NET5_0 + [Fact] + [ActiveIssue("12161", TestPlatforms.AnyUnix)] + public static void SqlExcpetionSerializationTest() + { + var formatter = new BinaryFormatter(); + SqlException e = CreateException(); + using (var stream = new MemoryStream()) + { + try + { + formatter.Serialize(stream, e); + stream.Position = 0; + var e2 = (SqlException)formatter.Deserialize(stream); + } + catch (Exception ex) + { + Assert.False(true, $"Unexpected Exception occurred: {ex.Message}"); + } + } + } +#endif + [Fact] public void JSONSerializationTest() { From 47f6d4d4f4f8267ea753c5c7a958433a3afdce49 Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Tue, 2 Feb 2021 11:27:54 -0800 Subject: [PATCH 08/23] Finalize review comments --- .../AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs index 9e822146b2..a4cd88754d 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs @@ -278,9 +278,14 @@ public PlatformSpecificTestContext() public void Dispose() { - //Fixture?.Dispose(); - akvFixture?.Dispose(); - certStoreFixture?.Dispose(); + try + { + akvFixture?.Dispose(); + } + finally + { + certStoreFixture?.Dispose(); + } } } } From 97f81b9b0713cf3b46715068415b62700a6ff3af Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Fri, 5 Feb 2021 10:29:48 -0800 Subject: [PATCH 09/23] Define constant --- .../tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj | 1 + .../tests/FunctionalTests/SqlExceptionTest.cs | 2 +- .../Microsoft.Data.SqlClient.ManualTesting.Tests.csproj | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj index c41a99cc4d..5d4103a9d2 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj @@ -7,6 +7,7 @@ Debug;Release;net46-Release;net46-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release AnyCPU;x86;x64 $(DefineConstants);NETCOREAPP + $(DefineConstants);NET5_AND_ABOVE $(ObjFolder)$(Configuration).$(Platform).$(AssemblyName) $(BinFolder)$(Configuration).$(Platform).$(AssemblyName) diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs index eb1678c9f4..28ad1a8c72 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs @@ -33,7 +33,7 @@ public void SerializationTest() Assert.Equal(e.StackTrace, sqlEx.StackTrace); } -#if !NET5_0 +#if !NET5_AND_ABOVE [Fact] [ActiveIssue("12161", TestPlatforms.AnyUnix)] public static void SqlExcpetionSerializationTest() diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj index 2a5bf658c5..054170fe9b 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj @@ -10,6 +10,7 @@ AnyCPU;x86;x64 $(DefineConstants);NETCOREAPP $(DefineConstants);NETFRAMEWORK + $(DefineConstants);NET5_AND_ABOVE $(ObjFolder)$(Configuration).$(Platform).$(AssemblyName) $(BinFolder)$(Configuration).$(Platform).$(AssemblyName) From 5473993acb8036e1bda6c3035e10f257df222b87 Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Fri, 5 Feb 2021 10:46:03 -0800 Subject: [PATCH 10/23] change constant name --- .../tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj | 2 +- .../Microsoft.Data.SqlClient.ManualTesting.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj index 5d4103a9d2..7484d678b7 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj @@ -7,7 +7,7 @@ Debug;Release;net46-Release;net46-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release AnyCPU;x86;x64 $(DefineConstants);NETCOREAPP - $(DefineConstants);NET5_AND_ABOVE + $(DefineConstants);NET50_OR_LATER $(ObjFolder)$(Configuration).$(Platform).$(AssemblyName) $(BinFolder)$(Configuration).$(Platform).$(AssemblyName) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj index 054170fe9b..fd85a9f69c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj @@ -10,7 +10,7 @@ AnyCPU;x86;x64 $(DefineConstants);NETCOREAPP $(DefineConstants);NETFRAMEWORK - $(DefineConstants);NET5_AND_ABOVE + $(DefineConstants);NET50_OR_LATER $(ObjFolder)$(Configuration).$(Platform).$(AssemblyName) $(BinFolder)$(Configuration).$(Platform).$(AssemblyName) From cfbd98764d9e3f26daa2cba404c5ec8a2cd93549 Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Fri, 5 Feb 2021 10:51:58 -0800 Subject: [PATCH 11/23] Constant name change --- .../tests/FunctionalTests/SqlExceptionTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs index 28ad1a8c72..3d749374ef 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs @@ -33,7 +33,7 @@ public void SerializationTest() Assert.Equal(e.StackTrace, sqlEx.StackTrace); } -#if !NET5_AND_ABOVE +#if !NET50_OR_LATER [Fact] [ActiveIssue("12161", TestPlatforms.AnyUnix)] public static void SqlExcpetionSerializationTest() From bc14d512350c1e2c640c06384f8ea6aadbc172ec Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Wed, 24 Feb 2021 13:28:51 -0800 Subject: [PATCH 12/23] Addressing review comments --- .../SqlColumnEncryptionCspProviderShould.cs | 14 +++++++ .../Microsoft.Data.SqlClient.Tests.csproj | 4 +- .../Setup/CertificateUtilityWin.cs | 37 ++++++++++++++++++- ....Data.SqlClient.ManualTesting.Tests.csproj | 6 +-- .../SQL/UdtTest/UDTs/Address/Address.csproj | 4 +- .../SQL/UdtTest/UDTs/Circle/Circle.csproj | 4 +- .../SQL/UdtTest/UDTs/Shapes/Shapes.csproj | 4 +- .../UdtTest/UDTs/Utf8String/Utf8String.csproj | 4 +- 8 files changed, 63 insertions(+), 14 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCspProviderShould.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCspProviderShould.cs index 874d510a7d..33f625146f 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCspProviderShould.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCspProviderShould.cs @@ -183,19 +183,33 @@ public void Dispose() public static void AddKeyToCsp(string containerName) { +#if NET50_OR_LATER +if (OperatingSystem.IsWindows()) + { +#endif CspParameters cspParams = new CspParameters(); cspParams.KeyContainerName = containerName; RSACryptoServiceProvider rsaAlg = new RSACryptoServiceProvider(KEY_SIZE, cspParams); rsaAlg.PersistKeyInCsp = true; +#if NET50_OR_LATER +} +#endif } public static void RemoveKeyFromCsp(string containerName) { +#if NET50_OR_LATER +if (OperatingSystem.IsWindows()) + { +#endif CspParameters cspParams = new CspParameters(); cspParams.KeyContainerName = containerName; RSACryptoServiceProvider rsaAlg = new RSACryptoServiceProvider(cspParams); rsaAlg.PersistKeyInCsp = false; rsaAlg.Clear(); +#if NET50_OR_LATER +} +#endif } } } diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj index 7484d678b7..d4f3cd5855 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj @@ -2,12 +2,12 @@ false FunctionalTests - netcoreapp netfx + netcoreapp Debug;Release;net46-Release;net46-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release AnyCPU;x86;x64 $(DefineConstants);NETCOREAPP - $(DefineConstants);NET50_OR_LATER + $(DefineConstants);NET50_OR_LATER $(ObjFolder)$(Configuration).$(Platform).$(AssemblyName) $(BinFolder)$(Configuration).$(Platform).$(AssemblyName) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs index 05077e804e..e69fe2588c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs @@ -49,6 +49,10 @@ internal static bool RSAPersistKeyInCsp(string providerName, string containerNam { try { +#if NET50_OR_LATER +if (OperatingSystem.IsWindows()) + { +#endif const int KEYSIZE = 2048; int providerType = GetProviderKey(providerName); @@ -60,6 +64,9 @@ internal static bool RSAPersistKeyInCsp(string providerName, string containerNam //key in the container. RSACryptoServiceProvider rsaAlg = new RSACryptoServiceProvider(KEYSIZE, cspParams); rsaAlg.PersistKeyInCsp = true; +#if NET50_OR_LATER +} +#endif } catch (CryptographicException e) { @@ -81,6 +88,10 @@ internal static bool RSADeleteKeyInCsp(string providerName, string containerName { try { +#if NET50_OR_LATER +if (OperatingSystem.IsWindows()) + { +#endif int providerType = GetProviderKey(providerName); // Create a new instance of CspParameters. @@ -96,6 +107,9 @@ internal static bool RSADeleteKeyInCsp(string providerName, string containerName //Call Clear to release resources and delete the key from the container. rsaAlg.Clear(); +#if NET50_OR_LATER +} +#endif } catch (CryptographicException e) { @@ -161,12 +175,22 @@ internal static X509Certificate2 GetCertificate(string certificateName, StoreLoc X509Store certStore = null; try { +#if NET50_OR_LATER +if (OperatingSystem.IsWindows()) + { +#endif certStore = new X509Store(StoreName.My, certificateStoreLocation); certStore.Open(OpenFlags.ReadOnly); X509Certificate2Collection certCollection = certStore.Certificates.Find(X509FindType.FindBySubjectName, certificateName, validOnly: false); Debug.Assert(certCollection != null && certCollection.Count > 0); - return certCollection[0]; +#if NET50_OR_LATER +} +else{ +return null; +} +#endif + } finally { @@ -182,6 +206,10 @@ internal static X509Certificate2 GetCertificate(string certificateName, StoreLoc /// internal static string GetCspPathFromCertificate(X509Certificate2 certificate) { +#if NET50_OR_LATER +if (OperatingSystem.IsWindows()) + { +#endif if (certificate.PrivateKey is RSACryptoServiceProvider csp) { return string.Concat(csp.CspKeyContainerInfo.ProviderName, @"/", csp.CspKeyContainerInfo.KeyContainerName); @@ -190,6 +218,13 @@ internal static string GetCspPathFromCertificate(X509Certificate2 certificate) { return null; } +#if NET50_OR_LATER +} +else +{ +return null; +} +#endif } /// diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj index fd85a9f69c..5891c7cc30 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj @@ -2,15 +2,15 @@ {45DB5F86-7AE3-45C6-870D-F9357B66BDB5} ManualTests - netcoreapp netfx + netcoreapp false Microsoft.Data.SqlClient.ManualTesting.Tests.ruleset Debug;Release;net46-Release;net46-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release AnyCPU;x86;x64 $(DefineConstants);NETCOREAPP $(DefineConstants);NETFRAMEWORK - $(DefineConstants);NET50_OR_LATER + $(DefineConstants);NET50_OR_LATER $(ObjFolder)$(Configuration).$(Platform).$(AssemblyName) $(BinFolder)$(Configuration).$(Platform).$(AssemblyName) @@ -53,7 +53,7 @@ - + Common\System\Collections\DictionaryExtensions.cs diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj index b83e9debb0..c9e86af2a5 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Address/Address.csproj @@ -3,8 +3,8 @@ Address Address {D1392B54-998A-4F27-BC17-4CE149117BCC} - netcoreapp - netfx + netfx + netcoreapp AnyCPU;x86;x64 Debug;Release;net46-Release;net46-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release $(ObjFolder)$(Configuration).$(Platform)\$(AssemblyName) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Circle/Circle.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Circle/Circle.csproj index e6e19d1655..f7faacbd49 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Circle/Circle.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Circle/Circle.csproj @@ -3,8 +3,8 @@ Circle Circle {6C88F00F-9597-43AD-9E5F-9B344DA3B16F} - netcoreapp - netfx + netfx + netcoreapp AnyCPU;x86;x64 Debug;Release;net46-Release;net46-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release $(ObjFolder)$(Configuration).$(Platform)\$(AssemblyName) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj index 91bfcd395f..a83c99e4a1 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj @@ -3,8 +3,8 @@ Shapes Shapes {B73A7063-37C3-415D-AD53-BB3DA20ABD6E} - netcoreapp - netfx + netfx + netcoreapp Debug;Release;net46-Release;net46-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release AnyCPU;x86;x64 $(ObjFolder)$(Configuration).$(Platform)\$(AssemblyName) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Utf8String/Utf8String.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Utf8String/Utf8String.csproj index 5826c8f99e..d319738204 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Utf8String/Utf8String.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Utf8String/Utf8String.csproj @@ -3,8 +3,8 @@ Utf8String Utf8String {E0A6BB21-574B-43D9-890D-6E1144F2EE9E} - netcoreapp - netfx + netfx + netcoreapp Debug;Release;net46-Release;net46-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release AnyCPU;x86;x64 $(ObjFolder)$(Configuration).$(Platform)\$(AssemblyName) From c04dbc516e3cb97566c8a7d76ff25c3ee61cb604 Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Wed, 24 Feb 2021 13:29:23 -0800 Subject: [PATCH 13/23] addressing review comments --- RunTests.cmd | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/RunTests.cmd b/RunTests.cmd index 36361db9dd..69c0b23381 100644 --- a/RunTests.cmd +++ b/RunTests.cmd @@ -21,9 +21,9 @@ call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:Re call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore3.1-functional-anycpu.xml call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore3.1-manual-anycpu.xml -call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=Package /p:TargetNetCoreVersion=netcoreapp5.0 -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore5.0-functional-anycpu.xml -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore5.0-manual-anycpu.xml +call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=Package /p:TargetNetCoreVersion=net5.0 +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore5.0-functional-anycpu.xml +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-net5.0-manual-anycpu.xml call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=Package /p:Platform=x64 call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetCoreVersion=netcoreapp2.1 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore2.1-functional-x64.xml @@ -33,9 +33,9 @@ call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:Re call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore3.1-functional-x64.xml call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore3.1-manual-x64.xml -call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=Package /p:Platform=x64 /p:TargetNetCoreVersion=netcoreapp5.0 -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore5.0-functional-x64.xml -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore5.0-manual-x64.xml +call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=Package /p:Platform=x64 /p:TargetNetCoreVersion=net5.0 +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore5.0-functional-x64.xml +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore5.0-manual-x64.xml call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=Package /p:Platform=Win32 call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetCoreVersion=netcoreapp2.1 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore2.1-functional-win32.xml @@ -45,9 +45,9 @@ call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:Re call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore3.1-functional-win32.xml call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore3.1-manual-win32.xml -call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=Package /p:Platform=Win32 /p:TargetNetCoreVersion=netcoreapp5.0 -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore5.0-functional-win32.xml -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore5.0-manual-win32.xml +call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=Package /p:Platform=Win32 /p:TargetNetCoreVersion=net5.0 +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore5.0-functional-win32.xml +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=Package -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\package-netcore5.0-manual-win32.xml :: REFERENCE TYPE "NETSTANDARDPACKAGE" call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=NetStandardPackage @@ -58,9 +58,9 @@ call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:Re call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore3.1-functional-anycpu.xml call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore3.1-manual-anycpu.xml -call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=NetStandardPackage /p:TargetNetCoreVersion=netcoreapp5.0 -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore5.0-functional-anycpu.xml -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore5.0-manual-anycpu.xml +call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=NetStandardPackage /p:TargetNetCoreVersion=net5.0 +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore5.0-functional-anycpu.xml +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore5.0-manual-anycpu.xml call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetFx /p:ReferenceType=NetStandardPackage /p:TargetNetFxVersion=net461 call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetFxVersion=net461 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-net461-functional-anycpu.xml @@ -78,9 +78,9 @@ call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:Re call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore3.1-functional-x64.xml call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore3.1-manual-x64.xml -call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=NetStandardPackage /p:Platform=x64 /p:TargetNetCoreVersion=netcoreapp5.0 -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore5.0-functional-x64.xml -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore5.0-manual-x64.xml +call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=NetStandardPackage /p:Platform=x64 /p:TargetNetCoreVersion=net5.0 +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore5.0-functional-x64.xml +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore5.0-manual-x64.xml call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetFx /p:ReferenceType=NetStandardPackage /p:Platform=x64 /p:TargetNetFxVersion=net461 call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests" /p:Platform="x64" /p:TargetNetFxVersion=net461 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-net461-functional-x64.xml @@ -98,9 +98,9 @@ call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:Re call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore3.1-functional-win32.xml call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore3.1-manual-win32.xml -call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=NetStandardPackage /p:Platform=Win32 /p:TargetNetCoreVersion=netcoreapp5.0 -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore5.0-functional-win32.xml -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore5.0-manual-win32.xml +call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=NetStandardPackage /p:Platform=Win32 /p:TargetNetCoreVersion=net5.0 +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore5.0-functional-win32.xml +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-netcore5.0-manual-win32.xml call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetFx /p:ReferenceType=NetStandardPackage /p:Platform=Win32 /p:TargetNetFxVersion=net461 call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests" /p:Platform="Win32" /p:TargetNetFxVersion=net461 /p:ReferenceType=NetStandardPackage -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandardpackage-net461-functional-win32.xml @@ -121,9 +121,9 @@ call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:Re call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=NetStandard -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandard-netcore3.1-functional-anycpu.xml call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=NetStandard -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandard-netcore3.1-manual-anycpu.xml -call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=NetStandard /p:TargetNetCoreVersion=netcoreapp5.0 -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=NetStandard -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandard-netcore5.0-functional-anycpu.xml -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=NetStandard -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandard-netcore5.0-manual-anycpu.xml +call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:ReferenceType=NetStandard /p:TargetNetCoreVersion=net5.0 +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=NetStandard -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandard-netcore5.0-functional-anycpu.xml +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=NetStandard -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\netstandard-netcore5.0-manual-anycpu.xml :: TESTING 'NETSTANDARD' REFERENCE TYPE WITH .NET FRAMEWORK 4.6.1+ AS TARGET FRAMEWORK IS INVALID CASE AS PROJECT REFERENCE DOES NOT LOAD SNI.DLL IN .NET FRAMEWORK RUNTIME. :: CASE IS VERIFIED WITH RUNTIME.NATIVE.SYSTEM.DATA.SQLCLIENT.SNI AS WELL. TO TEST .NET FRAMEWORK TARGETS, USE 'NETSTANDARDPACKAGE' REFERENCE TYPE ONLY. @@ -142,9 +142,9 @@ call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:Ta call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=Project -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\project-netcore3.1-functional-anycpu.xml call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp3.1 /p:ReferenceType=Project -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\project-netcore3.1-manual-anycpu.xml -call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:TargetNetCoreVersion=netcoreapp5.0 -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=Project -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\project-netcore5.0-functional-anycpu.xml -call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=netcoreapp5.0 /p:ReferenceType=Project -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\project-netcore5.0-manual-anycpu.xml +call :pauseOnError msbuild /p:Configuration="Release" /t:BuildTestsNetCore /p:TargetNetCoreVersion=net5.0 +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=Project -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\project-netcore5.0-functional-anycpu.xml +call :pauseOnError dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" /p:Platform="AnyCPU" /p:TargetNetCoreVersion=net5.0 /p:ReferenceType=Project -l:trx;LogFileName=..\..\..\..\..\artifacts\Results\project-netcore5.0-manual-anycpu.xml :: .NET FRAMEWORK REFERENCE TYPE "PROJECT" echo Building .NET Framework Tests From 8b3b1b68c6bbc8dcefd4e7cd9b5eec8fd2909bac Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Wed, 24 Feb 2021 13:32:04 -0800 Subject: [PATCH 14/23] review comments --- BUILDGUIDE.md | 4 ++-- .../SQL/SqlNotificationTest/SqlNotificationTest.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BUILDGUIDE.md b/BUILDGUIDE.md index b9879fb64c..0b032cfd70 100644 --- a/BUILDGUIDE.md +++ b/BUILDGUIDE.md @@ -208,7 +208,7 @@ Tests can be built and run with custom Target Frameworks. See the below examples ```bash > msbuild /t:BuildTestsNetCore /p:TargetNetCoreVersion=netcoreapp3.1 # Build the tests for custom TargetFramework (.NET Core) -# Applicable values: netcoreapp2.1 | netcoreapp2.2 | netcoreapp3.1 | netcoreapp5.0 +# Applicable values: netcoreapp2.1 | netcoreapp2.2 | netcoreapp3.1 | net5.0 ``` ### Running Tests: @@ -220,7 +220,7 @@ Tests can be built and run with custom Target Frameworks. See the below examples > dotnet test /p:TargetNetCoreVersion=netcoreapp3.1 ... # Use above property to run Functional Tests with custom TargetFramework (.NET Core) -# Applicable values: netcoreapp2.1 | netcoreapp2.2 | netcoreapp3.1 | netcoreapp5.0 +# Applicable values: netcoreapp2.1 | netcoreapp2.2 | netcoreapp3.1 | net5.0 ``` ## Using Managed SNI on Windows diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs index 57106a3d39..6f204cb47c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs @@ -11,7 +11,7 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests public class SqlNotificationTest : IDisposable { // Misc constants - private const int CALLBACK_TIMEOUT = 6000; // milliseconds + private const int CALLBACK_TIMEOUT = 5000; // milliseconds // Database schema private readonly string _tableName = $"dbo.[SQLDEP_{Guid.NewGuid().ToString()}]"; From f98b461825e7143b265a35e74b8fdc0d654b1c99 Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Wed, 24 Feb 2021 14:36:15 -0800 Subject: [PATCH 15/23] addressing review comments --- .../SQL/DataStreamTest/DataStreamTest.cs | 1 - .../SQL/RandomStressTest/Randomizer.cs | 15 --------------- 2 files changed, 16 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs index 6f3d72507b..a5b67acdd5 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs @@ -2012,7 +2012,6 @@ private static void TimeoutDuringReadAsyncWithClosedReaderTest(string connection catch (SqlException) { // In case of error, stop the proxy and dump its logs (hopefully this will help with debugging - // re-throwing exception will change the stack. we just throw the caught exception. proxy.Stop(); throw; } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/Randomizer.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/Randomizer.cs index 2f158fddd5..a03f145660 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/Randomizer.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/Randomizer.cs @@ -237,21 +237,6 @@ protected static int DeserializeInt(byte[] buf, ref int offset) return unchecked((int)uval); } - //this method is only used for Randomizer constructor to avoid using overridable method inside constructor. - private void DeserializeInitializer() - { - string base64State = GetCurrentState().ToString(); - Deserialize(Convert.FromBase64String(base64State), out _); - } - - /// - /// deserialization constructor - /// - public Randomizer(StreamingContext context) - { - DeserializeInitializer(); - } - /// /// use this method to create seeds for nested randomizers out of current one /// From 545684f83ddcc74d04288d22233c98901f003ec8 Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Wed, 24 Feb 2021 23:19:30 -0800 Subject: [PATCH 16/23] review comments --- .../ConnectivityTests/AADConnectionTest.cs | 31 +++++++------------ .../SQL/RandomStressTest/RandomizerPool.cs | 31 +++++++------------ 2 files changed, 22 insertions(+), 40 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs index 9e459a7796..6f6e49366c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs @@ -184,30 +184,21 @@ public static void GetAccessTokenByPasswordTest() public static void testADPasswordAuthentication() { // Connect to Azure DB with password and retrieve user name. - try + using (SqlConnection conn = new SqlConnection(DataTestUtility.AADPasswordConnectionString)) { - using (SqlConnection conn = new SqlConnection(DataTestUtility.AADPasswordConnectionString)) + conn.Open(); + using (SqlCommand sqlCommand = new SqlCommand + ( + cmdText: $"SELECT SUSER_SNAME();", + connection: conn, + transaction: null + )) { - conn.Open(); - using (SqlCommand sqlCommand = new SqlCommand - ( - cmdText: $"SELECT SUSER_SNAME();", - connection: conn, - transaction: null - )) - { - string customerId = (string)sqlCommand.ExecuteScalar(); - string expected = DataTestUtility.RetrieveValueFromConnStr(DataTestUtility.AADPasswordConnectionString, new string[] { "User ID", "UID" }); - Assert.Equal(expected, customerId); - } + string customerId = (string)sqlCommand.ExecuteScalar(); + string expected = DataTestUtility.RetrieveValueFromConnStr(DataTestUtility.AADPasswordConnectionString, new string[] { "User ID", "UID" }); + Assert.Equal(expected, customerId); } } - catch - { - // re-throwing exception in here will change the stack. - // we just throw caught exception. - throw; - } } [ConditionalFact(nameof(IsAADConnStringsSetup))] diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/RandomizerPool.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/RandomizerPool.cs index 341f74bdf8..c90779cd75 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/RandomizerPool.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RandomStressTest/RandomizerPool.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Threading; @@ -271,35 +272,25 @@ Randomizer.State[] IScope.GetStates() Randomizer IScope.Current { get { return Current; } } - // reverts the current thread scope to previous one - // This method is only used inside Dispose method. - // Note that the "last created scope" is not changed on Dispose, thus the scope instance. - // itself can still be used to collect repro states. - private void CheckCurrentRandomizerState() + /// + /// Disposes the scope and reverts the current thread scope to previous one. + /// Note that the "last created scope" is not changed on Dispose, thus the scope instance + /// itself can still be used to collect repro states. + /// + public void Dispose() { if (_current != null) { _current = null; - if (t_currentScope != this) - { - // every creation of scope in test must be balanced with Dispose call, use 'using' to enforce that! - // nested scopes are allowed, child scope must be disposed before the parent one - throw new InvalidOperationException("Unbalanced call to scope.Dispose"); - } - + // every creation of scope in test must be balanced with Dispose call, use 'using' to enforce that! + // nested scopes are allowed, child scope must be disposed before the parent one + // throw new InvalidOperationException("Unbalanced call to scope.Dispose"); + Trace.Assert(t_currentScope == this, "Unbalanced call to scope.Dispose"); t_currentScope = _previousScope; } } - /// - /// Disposes the scope. - /// - public void Dispose() - { - CheckCurrentRandomizerState(); - } - /// /// creates a new scope with Randomizer type or derived /// From 44bfcbf988dae044f387f4173e5ed24ba52a8ea8 Mon Sep 17 00:00:00 2001 From: jJRahnama Date: Sat, 27 Feb 2021 01:38:20 -0800 Subject: [PATCH 17/23] Review comments --- .../SqlColumnEncryptionCspProviderShould.cs | 15 +-------------- .../Microsoft.Data.SqlClient.Tests.csproj | 8 +++++--- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCspProviderShould.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCspProviderShould.cs index 33f625146f..8ffde57a15 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCspProviderShould.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCspProviderShould.cs @@ -183,33 +183,20 @@ public void Dispose() public static void AddKeyToCsp(string containerName) { -#if NET50_OR_LATER -if (OperatingSystem.IsWindows()) - { -#endif + CspParameters cspParams = new CspParameters(); cspParams.KeyContainerName = containerName; RSACryptoServiceProvider rsaAlg = new RSACryptoServiceProvider(KEY_SIZE, cspParams); rsaAlg.PersistKeyInCsp = true; -#if NET50_OR_LATER -} -#endif } public static void RemoveKeyFromCsp(string containerName) { -#if NET50_OR_LATER -if (OperatingSystem.IsWindows()) - { -#endif CspParameters cspParams = new CspParameters(); cspParams.KeyContainerName = containerName; RSACryptoServiceProvider rsaAlg = new RSACryptoServiceProvider(cspParams); rsaAlg.PersistKeyInCsp = false; rsaAlg.Clear(); -#if NET50_OR_LATER -} -#endif } } } diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj index d4f3cd5855..5e5ee3737e 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj @@ -14,12 +14,14 @@ - - - + + + + + From aacc6a837ef726c80463d693f935a3214946520c Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Mon, 1 Mar 2021 10:45:00 -0800 Subject: [PATCH 18/23] More Changes to address issues --- .../Setup/CertificateUtilityWin.cs | 36 ------------------- ....Data.SqlClient.ManualTesting.Tests.csproj | 32 +++++++++-------- .../SQL/UdtTest/UDTs/Shapes/Shapes.csproj | 2 +- 3 files changed, 18 insertions(+), 52 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs index e69fe2588c..bb98629c47 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs @@ -49,10 +49,6 @@ internal static bool RSAPersistKeyInCsp(string providerName, string containerNam { try { -#if NET50_OR_LATER -if (OperatingSystem.IsWindows()) - { -#endif const int KEYSIZE = 2048; int providerType = GetProviderKey(providerName); @@ -64,9 +60,6 @@ internal static bool RSAPersistKeyInCsp(string providerName, string containerNam //key in the container. RSACryptoServiceProvider rsaAlg = new RSACryptoServiceProvider(KEYSIZE, cspParams); rsaAlg.PersistKeyInCsp = true; -#if NET50_OR_LATER -} -#endif } catch (CryptographicException e) { @@ -88,10 +81,6 @@ internal static bool RSADeleteKeyInCsp(string providerName, string containerName { try { -#if NET50_OR_LATER -if (OperatingSystem.IsWindows()) - { -#endif int providerType = GetProviderKey(providerName); // Create a new instance of CspParameters. @@ -107,9 +96,6 @@ internal static bool RSADeleteKeyInCsp(string providerName, string containerName //Call Clear to release resources and delete the key from the container. rsaAlg.Clear(); -#if NET50_OR_LATER -} -#endif } catch (CryptographicException e) { @@ -175,22 +161,11 @@ internal static X509Certificate2 GetCertificate(string certificateName, StoreLoc X509Store certStore = null; try { -#if NET50_OR_LATER -if (OperatingSystem.IsWindows()) - { -#endif certStore = new X509Store(StoreName.My, certificateStoreLocation); certStore.Open(OpenFlags.ReadOnly); X509Certificate2Collection certCollection = certStore.Certificates.Find(X509FindType.FindBySubjectName, certificateName, validOnly: false); Debug.Assert(certCollection != null && certCollection.Count > 0); return certCollection[0]; -#if NET50_OR_LATER -} -else{ -return null; -} -#endif - } finally { @@ -206,10 +181,6 @@ internal static X509Certificate2 GetCertificate(string certificateName, StoreLoc /// internal static string GetCspPathFromCertificate(X509Certificate2 certificate) { -#if NET50_OR_LATER -if (OperatingSystem.IsWindows()) - { -#endif if (certificate.PrivateKey is RSACryptoServiceProvider csp) { return string.Concat(csp.CspKeyContainerInfo.ProviderName, @"/", csp.CspKeyContainerInfo.KeyContainerName); @@ -218,13 +189,6 @@ internal static string GetCspPathFromCertificate(X509Certificate2 certificate) { return null; } -#if NET50_OR_LATER -} -else -{ -return null; -} -#endif } /// diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj index 44cfd3d1ae..dbea157770 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj @@ -4,6 +4,9 @@ ManualTests netfx netcoreapp + $(OS) + true + true false Microsoft.Data.SqlClient.ManualTesting.Tests.ruleset Debug;Release;net461-Release;net461-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release @@ -14,30 +17,29 @@ $(ObjFolder)$(Configuration).$(Platform).$(AssemblyName) $(BinFolder)$(Configuration).$(Platform).$(AssemblyName) - - - - - - - - - - - - - - + + + + + + - + + + + + + + + diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj index 82160c83a3..6d6e2a4439 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UDTs/Shapes/Shapes.csproj @@ -5,7 +5,7 @@ {B73A7063-37C3-415D-AD53-BB3DA20ABD6E} netfx netcoreapp - Debug;Release;net461-Release;net461-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-ReleaseDebug;Release;net461-Release;net461-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release AnyCPU;x86;x64 $(ObjFolder)$(Configuration).$(Platform)\$(AssemblyName) $(BinFolder)$(Configuration).$(Platform)\$(AssemblyName) From e1187b35c4fb3c23ccafcce2c60f849fe2ce37c5 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Mon, 1 Mar 2021 11:52:16 -0800 Subject: [PATCH 19/23] Don't dispose certificate + other changes --- .../ExceptionsCertStore.cs | 6 ++--- .../Microsoft.Data.SqlClient.Tests.csproj | 1 + .../tests/FunctionalTests/SqlCommandTest.cs | 22 +++++++++---------- .../AlwaysEncrypted/ConversionTests.cs | 1 - .../TestFixtures/SQLSetupStrategy.cs | 3 --- .../TestFixtures/Setup/CertificateUtility.cs | 7 ------ 6 files changed, 15 insertions(+), 25 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/ExceptionsCertStore.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/ExceptionsCertStore.cs index e4a311c7b6..8559c26e54 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/ExceptionsCertStore.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/ExceptionsCertStore.cs @@ -41,7 +41,7 @@ public void CertificateNotFound() Assert.Matches(expectedMessage, e.Message); } -#if NET46 +#if NETFX [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.Netcoreapp)] public void CertificateWithNoPrivateKey() @@ -68,7 +68,7 @@ public class ExceptionCertFixture : IDisposable public static string thumbprint; public static byte[] cek; public static byte[] encryptedCek; -#if NET46 +#if NETFX public static X509Certificate2 masterKeyCertificateNPK; // no private key public static string thumbprintNPK; // No private key public static string masterKeyPathNPK; @@ -84,7 +84,7 @@ public ExceptionCertFixture() certificatePath = string.Format("CurrentUser/My/{0}", thumbprint); cek = Utility.GenerateRandomBytes(32); encryptedCek = certStoreProvider.EncryptColumnEncryptionKey(certificatePath, "RSA_OAEP", cek); -#if NET46 +#if NETFX if(masterKeyCertificateNPK == null) { masterKeyCertificateNPK = Utility.CreateCertificateWithNoPrivateKey(); diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj index 9516ddb3a2..339d74a6d9 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj @@ -6,6 +6,7 @@ netcoreapp Debug;Release;net461-Release;net461-Debug;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp3.1-Debug;netcoreapp3.1-Release AnyCPU;x86;x64 + $(DefineConstants);NETFX $(DefineConstants);NETCOREAPP $(DefineConstants);NET50_OR_LATER $(ObjFolder)$(Configuration).$(Platform).$(AssemblyName) diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlCommandTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlCommandTest.cs index ce81137140..c90a37b135 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlCommandTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlCommandTest.cs @@ -24,7 +24,7 @@ public void Constructor1() Assert.Null(cmd.Container); Assert.True(cmd.DesignTimeVisible); Assert.Null(cmd.Notification); -#if NET461 +#if NETFX // see https://github.com/dotnet/SqlClient/issues/17 Assert.True(cmd.NotificationAutoEnlist); #endif @@ -46,7 +46,7 @@ public void Constructor2() Assert.Null(cmd.Container); Assert.True(cmd.DesignTimeVisible); Assert.Null(cmd.Notification); -#if NET461 +#if NETFX // see https://github.com/dotnet/SqlClient/issues/17 Assert.True(cmd.NotificationAutoEnlist); #endif @@ -64,7 +64,7 @@ public void Constructor2() Assert.Null(cmd.Container); Assert.True(cmd.DesignTimeVisible); Assert.Null(cmd.Notification); -#if NET461 +#if NETFX // see https://github.com/dotnet/SqlClient/issues/17 Assert.True(cmd.NotificationAutoEnlist); #endif @@ -89,7 +89,7 @@ public void Constructor3() Assert.Null(cmd.Container); Assert.True(cmd.DesignTimeVisible); Assert.Null(cmd.Notification); -#if NET461 +#if NETFX // see https://github.com/dotnet/SqlClient/issues/17 Assert.True(cmd.NotificationAutoEnlist); #endif @@ -107,7 +107,7 @@ public void Constructor3() Assert.Null(cmd.Container); Assert.True(cmd.DesignTimeVisible); Assert.Null(cmd.Notification); -#if NET461 +#if NETFX // see https://github.com/dotnet/SqlClient/issues/17 Assert.True(cmd.NotificationAutoEnlist); #endif @@ -125,7 +125,7 @@ public void Constructor3() Assert.Null(cmd.Container); Assert.True(cmd.DesignTimeVisible); Assert.Null(cmd.Notification); -#if NET461 +#if NETFX // see https://github.com/dotnet/SqlClient/issues/17 Assert.True(cmd.NotificationAutoEnlist); #endif @@ -166,7 +166,7 @@ public void Constructor4() Assert.Null(cmd.Container); Assert.True(cmd.DesignTimeVisible); Assert.Null(cmd.Notification); -#if NET461 +#if NETFX // see https://github.com/dotnet/SqlClient/issues/17 Assert.True(cmd.NotificationAutoEnlist); #endif @@ -184,7 +184,7 @@ public void Constructor4() Assert.Null(cmd.Container); Assert.True(cmd.DesignTimeVisible); Assert.Null(cmd.Notification); -#if NET461 +#if NETFX // see https://github.com/dotnet/SqlClient/issues/17 Assert.True(cmd.NotificationAutoEnlist); #endif @@ -202,7 +202,7 @@ public void Constructor4() Assert.Null(cmd.Container); Assert.True(cmd.DesignTimeVisible); Assert.Null(cmd.Notification); -#if NET461 +#if NETFX // see https://github.com/dotnet/SqlClient/issues/17 Assert.True(cmd.NotificationAutoEnlist); #endif @@ -224,7 +224,7 @@ public void Clone() cmd.CommandType = CommandType.StoredProcedure; cmd.DesignTimeVisible = false; cmd.Notification = notificationReq; -#if NET461 +#if NETFX // see https://github.com/dotnet/SqlClient/issues/17 Assert.True(cmd.NotificationAutoEnlist); #endif @@ -240,7 +240,7 @@ public void Clone() Assert.Null(cmd.Connection); Assert.False(cmd.DesignTimeVisible); Assert.Same(notificationReq, cmd.Notification); -#if NET461 +#if NETFX // see https://github.com/dotnet/SqlClient/issues/17 Assert.True(cmd.NotificationAutoEnlist); #endif diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ConversionTests.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ConversionTests.cs index 65fce96d40..3746b9988c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ConversionTests.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ConversionTests.cs @@ -1354,7 +1354,6 @@ public void Dispose() databaseObjects.ForEach(o => o.Drop(sqlConnection)); } } - certificate?.Dispose(); } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs index aef242a360..619c0b5930 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs @@ -255,7 +255,6 @@ public void Dispose() databaseObjects.ForEach(o => o.Drop(sqlConnection)); } } - certificate?.Dispose(); } } @@ -273,12 +272,10 @@ public PlatformSpecificTestContext() { certStoreFixture = new SQLSetupStrategyCertStoreProvider(); } -#if !NET46 else { akvFixture = new SQLSetupStrategyAzureKeyVault(); } -#endif } public void Dispose() diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtility.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtility.cs index 7e32a4605d..1c054f3769 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtility.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtility.cs @@ -11,11 +11,9 @@ using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; -#if !NET46 using Azure; using Azure.Identity; using Azure.Security.KeyVault.Keys; -#endif namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted { class CertificateUtility @@ -133,10 +131,6 @@ internal static X509Certificate2 CreateCertificate() } } -#if NET46 - return certificate; - } -#else if (DataTestUtility.IsAKVSetupAvailable()) { SetupAKVKeysAsync().Wait(); @@ -179,7 +173,6 @@ private static async Task SetupAKVKeysAsync() keyClient.CreateRsaKey(rsaKeyOptions); } } -#endif /// /// Removes a certificate from the local certificate store (useful for test cleanup). From 84e874af1bb54f2e0ad4a7c9ed106b075fe5dd50 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Mon, 1 Mar 2021 12:54:01 -0800 Subject: [PATCH 20/23] More fixes for net5 --- .../TestFixtures/Setup/CertificateUtilityWin.cs | 6 ++++++ .../tests/ManualTests/SQL/UdtTest/UdtTest.cs | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs index bb98629c47..91a0b6e7fb 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs @@ -7,9 +7,15 @@ using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using Xunit; +#if NET50_OR_LATER +using System.Runtime.Versioning; +#endif namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted { +#if NET50_OR_LATER + [SupportedOSPlatform("windows")] +#endif [PlatformSpecific(TestPlatforms.Windows)] class CertificateUtilityWin { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest.cs index fd56a4d80b..e0dc1add4c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest.cs @@ -294,8 +294,6 @@ public void NullTest() { if(e.Message.Contains("Rerun the transaction")) rerun = true; - else - throw e; } } while(rerun); From f2cfea4b161754c4f342310f21b2d334029390c7 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Mon, 1 Mar 2021 13:39:09 -0800 Subject: [PATCH 21/23] More Net5 fixes --- .../ManualTests/AlwaysEncrypted/CspProviderExt.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/CspProviderExt.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/CspProviderExt.cs index 49dd608d99..ec635afd03 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/CspProviderExt.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/CspProviderExt.cs @@ -7,6 +7,9 @@ using System.Security.Cryptography.X509Certificates; using Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted.Setup; using Xunit; +#if NET50_OR_LATER +using System.Runtime.Versioning; +#endif namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted { @@ -14,6 +17,9 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted /// Always Encrypted public CspProvider Manual tests. /// TODO: These tests are marked as Windows only for now but should be run for all platforms once the Master Key is accessible to this app from Azure Key Vault. /// +#if NET50_OR_LATER + [SupportedOSPlatform("windows")] +#endif [PlatformSpecific(TestPlatforms.Windows)] public class CspProviderExt { @@ -81,9 +87,10 @@ public void TestKeysFromCertificatesCreatedWithMultipleCryptoProviders(string co DatabaseHelper.InsertCustomerData(sqlConn, tableName, customer); // Test INPUT parameter on an encrypted parameter - using (SqlCommand sqlCommand = new SqlCommand(string.Format(@"SELECT CustomerId, FirstName, LastName FROM [{0}] WHERE FirstName = @firstName", tableName), + using (SqlCommand sqlCommand = new SqlCommand(@"SELECT CustomerId, FirstName, LastName FROM [@tableName] WHERE FirstName = @firstName", sqlConn, null, SqlCommandColumnEncryptionSetting.Enabled)) { + sqlCommand.Parameters.AddWithValue(@"tableName", tableName); SqlParameter customerFirstParam = sqlCommand.Parameters.AddWithValue(@"firstName", @"Microsoft"); customerFirstParam.Direction = System.Data.ParameterDirection.Input; @@ -173,9 +180,10 @@ public void TestEncryptDecryptWithCSP(string connectionString) DatabaseHelper.InsertCustomerData(sqlConn, tableName, customer); // Test INPUT parameter on an encrypted parameter - using (SqlCommand sqlCommand = new SqlCommand(string.Format(@"SELECT CustomerId, FirstName, LastName FROM [{0}] WHERE FirstName = @firstName", tableName), + using (SqlCommand sqlCommand = new SqlCommand(@"SELECT CustomerId, FirstName, LastName FROM [@tableName] WHERE FirstName = @firstName", sqlConn, null, SqlCommandColumnEncryptionSetting.Enabled)) { + sqlCommand.Parameters.AddWithValue(@"tableName", tableName); SqlParameter customerFirstParam = sqlCommand.Parameters.AddWithValue(@"firstName", @"Microsoft"); customerFirstParam.Direction = System.Data.ParameterDirection.Input; From 4b1cdd2a92780322e3e1b146728669e2c21a950d Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Mon, 1 Mar 2021 16:02:15 -0800 Subject: [PATCH 22/23] Address review comments --- .../tests/ManualTests/SQL/Common/AsyncDebugScope.cs | 4 ++-- .../tests/ManualTests/SQL/UdtTest/UdtTest.cs | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/Common/AsyncDebugScope.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/Common/AsyncDebugScope.cs index 06ba6edcb8..520081e435 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/Common/AsyncDebugScope.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/Common/AsyncDebugScope.cs @@ -88,6 +88,7 @@ public void Dispose() { _reader.CompletePendingReadWithSuccess(true); } + _reader.Dispose(); } if (_command != null) @@ -100,9 +101,8 @@ public void Dispose() { _command.CompletePendingReadWithSuccess(true); } + _command.Dispose(); } - _reader.Dispose(); - _command.Dispose(); } } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest.cs index e0dc1add4c..666b7bd258 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest.cs @@ -292,11 +292,17 @@ public void NullTest() } catch (SqlException e) { - if(e.Message.Contains("Rerun the transaction")) + if (e.Message.Contains("Rerun the transaction")) + { rerun = true; + } + else + { + throw; + } } } - while(rerun); + while (rerun); } } } From 65e6e3dba9de367d8ef6b1457ef6ebbcd2a85cf8 Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Mon, 1 Mar 2021 16:12:05 -0800 Subject: [PATCH 23/23] Unwanted call removed. --- .../ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs index 6f204cb47c..5cf1e99e93 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs @@ -175,7 +175,6 @@ public void Test_SingleDependency_AllDefaults_SqlAuth() updateCompleted.Set(); Assert.True(notificationReceived.Wait(CALLBACK_TIMEOUT), "Notification not received within the timeout period"); - notificationReceived.Reset(); } finally {