From 8e0039112a1db9f9eb250fe9279190955c30a6e6 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 10 Nov 2025 11:03:42 -0400 Subject: [PATCH 01/13] User Story 40114: Release activities for v5.1.8 - Updated key dependencies to the latest versions that don't trigger major version bumps. - Updated xUnit packages and made associated test changes for modernization. - Updated .NET Framework project to build on Linux. --- build.proj | 4 +- src/Directory.Build.props | 5 + src/Microsoft.Data.SqlClient.sln | 22 +- .../netfx/src/Microsoft.Data.SqlClient.csproj | 28 +- .../GenerateResourceStringsSource.targets | 5 +- .../ActiveDirectoryAuthenticationProvider.cs | 6 + ...ncryptionCertificateStoreProviderShould.cs | 2 +- .../tests/FunctionalTests/AssertExtensions.cs | 321 ++++++++++++++++++ .../BaseProviderAsyncTest.cs | 76 ++--- .../Microsoft.Data.SqlClient.Tests.csproj | 15 +- .../FunctionalTests/PlatformDetection.cs | 16 + .../SqlBulkCopyColumnMappingCollectionTest.cs | 13 +- ...qlBulkCopyColumnOrderHintCollectionTest.cs | 13 +- .../SqlConfigurableRetryLogicTest.cs | 7 +- .../SqlConnectionBasicTests.cs | 4 +- .../SqlConnectionTest.RetrieveStatistics.cs | 5 - .../FunctionalTests/SqlDataRecordTest.cs | 2 +- .../tests/FunctionalTests/SqlErrorTest.cs | 2 +- .../tests/FunctionalTests/SqlHelperTest.cs | 2 +- ....Data.SqlClient.ManualTesting.Tests.csproj | 16 +- .../ManualTests/SQL/AsyncTest/AsyncTest.cs | 2 +- .../ConnectivityTests/AADConnectionTest.cs | 2 +- .../SQL/DataStreamTest/DataStreamTest.cs | 2 +- .../ExceptionTest/ConnectionExceptionTest.cs | 2 +- .../IntegratedAuthenticationTest.cs | 2 +- .../SQL/LocalDBTest/LocalDBTest.cs | 32 +- .../MARSSessionPoolingTest.cs | 4 +- .../ManualTests/SQL/ParameterTest/TvpTest.cs | 2 +- .../RetryLogic/SqlCommandReliabilityTest.cs | 4 +- .../SqlConnectionReliabilityTest.cs | 4 +- .../SQL/SplitPacketTest/SplitPacketTest.cs | 2 +- .../SQL/SqlBulkCopyTest/SqlBulkCopyTest.cs | 2 +- .../SQL/SqlCommand/SqlCommandCancelTest.cs | 6 +- .../SqlNotificationTest.cs | 2 +- .../SQL/UdtTest/UdtBulkCopyTest.cs | 2 +- .../tests/ManualTests/SQL/UdtTest/UdtTest2.cs | 2 +- .../WeakRefTestYukonSpecific.cs | 2 +- ...crosoft.Data.SqlClient.ExtUtilities.csproj | 1 + tools/props/Versions.props | 23 +- 39 files changed, 501 insertions(+), 161 deletions(-) create mode 100644 src/Microsoft.Data.SqlClient/tests/FunctionalTests/AssertExtensions.cs create mode 100644 src/Microsoft.Data.SqlClient/tests/FunctionalTests/PlatformDetection.cs diff --git a/build.proj b/build.proj index 1f295abc94..32087f07de 100644 --- a/build.proj +++ b/build.proj @@ -53,7 +53,7 @@ - + @@ -64,7 +64,7 @@ - + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index be2fe1f22a..20936f7e15 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -105,4 +105,9 @@ + + + false + + diff --git a/src/Microsoft.Data.SqlClient.sln b/src/Microsoft.Data.SqlClient.sln index c5b34945a0..b81edeb8e8 100644 --- a/src/Microsoft.Data.SqlClient.sln +++ b/src/Microsoft.Data.SqlClient.sln @@ -1,3 +1,4 @@ + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31912.275 @@ -11,9 +12,6 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TDS.Servers", "Microsoft.Data.SqlClient\tests\tools\TDS\TDS.Servers\TDS.Servers.csproj", "{978063D3-FBB5-4E10-8C45-67C90BE1B931}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TDS", "Microsoft.Data.SqlClient\tests\tools\TDS\TDS\TDS.csproj", "{8DC9D1A0-351B-47BC-A90F-B9DA542550E9}" - ProjectSection(ProjectDependencies) = postProject - {FDA6971D-9F57-4DA4-B10A-261C91684CFC} = {FDA6971D-9F57-4DA4-B10A-261C91684CFC} - EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Data.SqlClient.Tests", "Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj", "{D2D1E2D1-B6E0-489F-A36D-1F3047AB87B9}" ProjectSection(ProjectDependencies) = postProject @@ -28,7 +26,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "netfx", "netfx", "{3FDD425C EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Address", "Microsoft.Data.SqlClient\tests\ManualTests\SQL\UdtTest\UDTs\Address\Address.csproj", "{D1392B54-998A-4F27-BC17-4CE149117BCC}" ProjectSection(ProjectDependencies) = postProject - {FDA6971D-9F57-4DA4-B10A-261C91684CFC} = {FDA6971D-9F57-4DA4-B10A-261C91684CFC} {37431336-5307-4184-9356-C4B7E47DC714} = {37431336-5307-4184-9356-C4B7E47DC714} {407890AC-9876-4FEF-A6F1-F36A876BAADE} = {407890AC-9876-4FEF-A6F1-F36A876BAADE} EndProjectSection @@ -40,13 +37,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Data.SqlClient.Ma EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Circle", "Microsoft.Data.SqlClient\tests\ManualTests\SQL\UdtTest\UDTs\Circle\Circle.csproj", "{6C88F00F-9597-43AD-9E5F-9B344DA3B16F}" ProjectSection(ProjectDependencies) = postProject - {FDA6971D-9F57-4DA4-B10A-261C91684CFC} = {FDA6971D-9F57-4DA4-B10A-261C91684CFC} {37431336-5307-4184-9356-C4B7E47DC714} = {37431336-5307-4184-9356-C4B7E47DC714} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shapes", "Microsoft.Data.SqlClient\tests\ManualTests\SQL\UdtTest\UDTs\Shapes\Shapes.csproj", "{B73A7063-37C3-415D-AD53-BB3DA20ABD6E}" ProjectSection(ProjectDependencies) = postProject - {FDA6971D-9F57-4DA4-B10A-261C91684CFC} = {FDA6971D-9F57-4DA4-B10A-261C91684CFC} {37431336-5307-4184-9356-C4B7E47DC714} = {37431336-5307-4184-9356-C4B7E47DC714} EndProjectSection EndProject @@ -72,8 +67,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Data.SqlClient.Al EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "add-ons", "add-ons", "{C9726AED-D6A3-4AAC-BA04-92DD1F079594}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.XUnitExtensions", "Microsoft.Data.SqlClient\tests\tools\Microsoft.DotNet.XUnitExtensions\Microsoft.DotNet.XUnitExtensions.csproj", "{FDA6971D-9F57-4DA4-B10A-261C91684CFC}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{ED952CF7-84DF-437A-B066-F516E9BE1C2C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "snippets", "snippets", "{71F356DC-DFA3-4163-8BFE-D268722CE189}" @@ -383,18 +376,6 @@ Global {9073ABEF-92E0-4702-BB23-2C99CEF9BDD7}.Release|x64.Build.0 = Release|Any CPU {9073ABEF-92E0-4702-BB23-2C99CEF9BDD7}.Release|x86.ActiveCfg = Release|Any CPU {9073ABEF-92E0-4702-BB23-2C99CEF9BDD7}.Release|x86.Build.0 = Release|Any CPU - {FDA6971D-9F57-4DA4-B10A-261C91684CFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FDA6971D-9F57-4DA4-B10A-261C91684CFC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FDA6971D-9F57-4DA4-B10A-261C91684CFC}.Debug|x64.ActiveCfg = Debug|Any CPU - {FDA6971D-9F57-4DA4-B10A-261C91684CFC}.Debug|x64.Build.0 = Debug|Any CPU - {FDA6971D-9F57-4DA4-B10A-261C91684CFC}.Debug|x86.ActiveCfg = Debug|Any CPU - {FDA6971D-9F57-4DA4-B10A-261C91684CFC}.Debug|x86.Build.0 = Debug|Any CPU - {FDA6971D-9F57-4DA4-B10A-261C91684CFC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FDA6971D-9F57-4DA4-B10A-261C91684CFC}.Release|Any CPU.Build.0 = Release|Any CPU - {FDA6971D-9F57-4DA4-B10A-261C91684CFC}.Release|x64.ActiveCfg = Release|Any CPU - {FDA6971D-9F57-4DA4-B10A-261C91684CFC}.Release|x64.Build.0 = Release|Any CPU - {FDA6971D-9F57-4DA4-B10A-261C91684CFC}.Release|x86.ActiveCfg = Release|Any CPU - {FDA6971D-9F57-4DA4-B10A-261C91684CFC}.Release|x86.Build.0 = Release|Any CPU {F5DF2FDC-C860-4CB3-8B24-7C903C6FC076}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F5DF2FDC-C860-4CB3-8B24-7C903C6FC076}.Debug|x64.ActiveCfg = Debug|Any CPU {F5DF2FDC-C860-4CB3-8B24-7C903C6FC076}.Debug|x64.Build.0 = Debug|Any CPU @@ -510,7 +491,6 @@ Global {771F3F1E-7A68-4A9D-ADA8-A24F1D5BE71D} = {3FDD425C-FE01-4B56-863E-1FCDD0677CF5} {412BCCC8-19F6-489A-B594-E9A506816155} = {771F3F1E-7A68-4A9D-ADA8-A24F1D5BE71D} {9073ABEF-92E0-4702-BB23-2C99CEF9BDD7} = {C9726AED-D6A3-4AAC-BA04-92DD1F079594} - {FDA6971D-9F57-4DA4-B10A-261C91684CFC} = {0CC4817A-12F3-4357-912C-09315FAAD008} {71F356DC-DFA3-4163-8BFE-D268722CE189} = {ED952CF7-84DF-437A-B066-F516E9BE1C2C} {908C7DD3-C999-40A6-9433-9F5ACA7C36F5} = {71F356DC-DFA3-4163-8BFE-D268722CE189} {0CE216CE-8072-4985-B248-61F0D0BE9C2E} = {71F356DC-DFA3-4163-8BFE-D268722CE189} diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index cd49858ff6..973dea69d6 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -17,9 +17,6 @@ $(OutputPath)\Microsoft.Data.SqlClient.xml $(ObjPath)$(AssemblyName)\netfx\ Framework $(BaseProduct) - - True $(DefineConstants);NETFRAMEWORK; @@ -43,7 +40,10 @@ True True None - MinimumRecommendedRules.ruleset + + + MinimumRecommendedRules.ruleset + True True $(DefineConstants);USEOFFSET;CODE_ANALYSIS_BASELINE;FEATURE_LEGACYSURFACEAREA;FEATURE_UTF32;FEATURE_UTF7;TRACE; @@ -704,17 +704,6 @@ PreserveNewest - - - {5477469E-83B1-11D2-8B49-00A0C9B7C9C4} - 2 - 4 - 0 - tlbimp - False - True - - $(MicrosoftDataSqlClientSniVersion) @@ -731,6 +720,15 @@ + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + diff --git a/src/Microsoft.Data.SqlClient/netfx/tools/targets/GenerateResourceStringsSource.targets b/src/Microsoft.Data.SqlClient/netfx/tools/targets/GenerateResourceStringsSource.targets index 618fbd6d51..eb2be2ae9d 100644 --- a/src/Microsoft.Data.SqlClient/netfx/tools/targets/GenerateResourceStringsSource.targets +++ b/src/Microsoft.Data.SqlClient/netfx/tools/targets/GenerateResourceStringsSource.targets @@ -1,11 +1,10 @@ - + - \ No newline at end of file + diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs index d69cbe06ab..de5732c3aa 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs @@ -220,7 +220,9 @@ public override async Task AcquireTokenAsync(SqlAuthenti { if (!string.IsNullOrEmpty(parameters.UserId)) { + #pragma warning disable CS0618 // Type or member is obsolete result = await app.AcquireTokenByIntegratedWindowsAuth(scopes) + #pragma warning restore CS0618 // Type or member is obsolete .WithCorrelationId(parameters.ConnectionId) .WithUsername(parameters.UserId) .ExecuteAsync(cancellationToken: cts.Token) @@ -228,7 +230,9 @@ public override async Task AcquireTokenAsync(SqlAuthenti } else { + #pragma warning disable CS0618 // Type or member is obsolete result = await app.AcquireTokenByIntegratedWindowsAuth(scopes) + #pragma warning restore CS0618 // Type or member is obsolete .WithCorrelationId(parameters.ConnectionId) .ExecuteAsync(cancellationToken: cts.Token) .ConfigureAwait(false); @@ -252,7 +256,9 @@ previousPw is byte[] previousPwBytes && if (null == result) { + #pragma warning disable CS0618 // Type or member is obsolete result = await app.AcquireTokenByUsernamePassword(scopes, parameters.UserId, parameters.Password) + #pragma warning restore CS0618 // Type or member is obsolete .WithCorrelationId(parameters.ConnectionId) .ExecuteAsync(cancellationToken: cts.Token) .ConfigureAwait(false); diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs index 5b7dd192ef..31c3504d84 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs @@ -303,7 +303,7 @@ public void TestAeadEncryptionReversal(string dataType, object data, Utility.CCo break; default: - Assert.True(false, "unexpected data type."); + Assert.Fail("unexpected data type."); break; } diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AssertExtensions.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AssertExtensions.cs new file mode 100644 index 0000000000..937a2ad9e0 --- /dev/null +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AssertExtensions.cs @@ -0,0 +1,321 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Linq; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Xunit; +using Xunit.Sdk; + +namespace System +{ + public static class AssertExtensions + { + private static bool IsFullFramework => RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework"); + + public static void Throws(Action action, string message) + where T : Exception + { + Assert.Equal(Assert.Throws(action).Message, message); + } + + public static void Throws(string netCoreParamName, string netFxParamName, Action action) + where T : ArgumentException + { + T exception = Assert.Throws(action); + + if (netFxParamName == null && IsFullFramework) + { + // Param name varies between NETFX versions -- skip checking it + return; + } + + string expectedParamName = + IsFullFramework ? + netFxParamName : netCoreParamName; + + if (!RuntimeInformation.FrameworkDescription.StartsWith(".NET Native")) + Assert.Equal(expectedParamName, exception.ParamName); + } + + public static void Throws(string netCoreParamName, string netFxParamName, Func testCode) + where T : ArgumentException + { + T exception = Assert.Throws(testCode); + + if (netFxParamName == null && IsFullFramework) + { + // Param name varies between NETFX versions -- skip checking it + return; + } + + string expectedParamName = + IsFullFramework ? + netFxParamName : netCoreParamName; + + if (!RuntimeInformation.FrameworkDescription.StartsWith(".NET Native")) + Assert.Equal(expectedParamName, exception.ParamName); + } + + public static T Throws(string paramName, Action action) + where T : ArgumentException + { + T exception = Assert.Throws(action); + + if (!RuntimeInformation.FrameworkDescription.StartsWith(".NET Native")) + Assert.Equal(paramName, exception.ParamName); + + return exception; + } + + public static T Throws(Action action) + where T : Exception + { + T exception = Assert.Throws(action); + + return exception; + } + + public static T Throws(string paramName, Func testCode) + where T : ArgumentException + { + T exception = Assert.Throws(testCode); + + if (!RuntimeInformation.FrameworkDescription.StartsWith(".NET Native")) + Assert.Equal(paramName, exception.ParamName); + + return exception; + } + + public static async Task ThrowsAsync(string paramName, Func testCode) + where T : ArgumentException + { + T exception = await Assert.ThrowsAsync(testCode); + + if (!RuntimeInformation.FrameworkDescription.StartsWith(".NET Native")) + Assert.Equal(paramName, exception.ParamName); + + return exception; + } + + public static void Throws(string paramName, Action action) + where TNetCoreExceptionType : ArgumentException + where TNetFxExceptionType : ArgumentException + { + Throws(paramName, paramName, action); + } + + public static Exception Throws(Action action) + where TNetCoreExceptionType : Exception + where TNetFxExceptionType : Exception + { + return Throws(typeof(TNetCoreExceptionType), typeof(TNetFxExceptionType), action); + } + + public static Exception Throws(Type netCoreExceptionType, Type netFxExceptionType, Action action) + { + if (IsFullFramework) + { + return Assert.Throws(netFxExceptionType, action); + } + else + { + return Assert.Throws(netCoreExceptionType, action); + } + } + + public static void Throws(string netCoreParamName, string netFxParamName, Action action) + where TNetCoreExceptionType : ArgumentException + where TNetFxExceptionType : ArgumentException + { + if (IsFullFramework) + { + Throws(netFxParamName, action); + } + else + { + Throws(netCoreParamName, action); + } + } + + public static void ThrowsAny(Type firstExceptionType, Type secondExceptionType, Action action) + { + ThrowsAnyInternal(action, firstExceptionType, secondExceptionType); + } + + private static void ThrowsAnyInternal(Action action, params Type[] exceptionTypes) + { + try + { + action(); + } + catch (Exception e) + { + Type exceptionType = e.GetType(); + if (exceptionTypes.Any(t => t.Equals(exceptionType))) + return; + + throw new XunitException($"Expected one of: ({string.Join(", ", exceptionTypes)}) -> Actual: ({e.GetType()})"); + } + + throw new XunitException($"Expected one of: ({string.Join(", ", exceptionTypes)}) -> Actual: No exception thrown"); + } + + public static void ThrowsAny(Action action) + where TFirstExceptionType : Exception + where TSecondExceptionType : Exception + { + ThrowsAnyInternal(action, typeof(TFirstExceptionType), typeof(TSecondExceptionType)); + } + + public static void ThrowsAny(Action action) + where TFirstExceptionType : Exception + where TSecondExceptionType : Exception + where TThirdExceptionType : Exception + { + ThrowsAnyInternal(action, typeof(TFirstExceptionType), typeof(TSecondExceptionType), typeof(TThirdExceptionType)); + } + + public static void ThrowsIf(bool condition, Action action) + where T : Exception + { + if (condition) + { + Assert.Throws(action); + } + else + { + action(); + } + } + + private static string AddOptionalUserMessage(string message, string userMessage) + { + if (userMessage == null) + return message; + else + return $"{message} {userMessage}"; + } + + /// + /// Tests whether the specified string contains the specified substring + /// and throws an exception if the substring does not occur within the + /// test string or if either string or substring is null. + /// + /// + /// The string that is expected to contain . + /// + /// + /// The string expected to occur within . + /// + public static void Contains(string value, string substring) + { + Assert.NotNull(value); + Assert.NotNull(substring); + Assert.Contains(substring, value, StringComparison.Ordinal); + } + + /// + /// Validate that a given value is greater than another value. + /// + /// The value that should be greater than . + /// The value that should be greater than. + public static void GreaterThan(T actual, T greaterThan, string userMessage = null) where T : IComparable + { + if (actual == null) + throw new XunitException( + greaterThan == null + ? AddOptionalUserMessage($"Expected: to be greater than .", userMessage) + : AddOptionalUserMessage($"Expected: to be greater than {greaterThan}.", userMessage)); + + if (actual.CompareTo(greaterThan) <= 0) + throw new XunitException(AddOptionalUserMessage($"Expected: {actual} to be greater than {greaterThan}", userMessage)); + } + + /// + /// Validate that a given value is less than another value. + /// + /// The value that should be less than . + /// The value that should be less than. + public static void LessThan(T actual, T lessThan, string userMessage = null) where T : IComparable + { + if (actual == null) + { + if (lessThan == null) + { + throw new XunitException(AddOptionalUserMessage($"Expected: to be less than .", userMessage)); + } + else + { + // Null is always less than non-null + return; + } + } + + if (actual.CompareTo(lessThan) >= 0) + throw new XunitException(AddOptionalUserMessage($"Expected: {actual} to be less than {lessThan}", userMessage)); + } + + /// + /// Validate that a given value is less than or equal to another value. + /// + /// The value that should be less than or equal to + /// The value that should be less than or equal to. + public static void LessThanOrEqualTo(T actual, T lessThanOrEqualTo, string userMessage = null) where T : IComparable + { + // null, by definition is always less than or equal to + if (actual == null) + return; + + if (actual.CompareTo(lessThanOrEqualTo) > 0) + throw new XunitException(AddOptionalUserMessage($"Expected: {actual} to be less than or equal to {lessThanOrEqualTo}", userMessage)); + } + + /// + /// Validate that a given value is greater than or equal to another value. + /// + /// The value that should be greater than or equal to + /// The value that should be greater than or equal to. + public static void GreaterThanOrEqualTo(T actual, T greaterThanOrEqualTo, string userMessage = null) where T : IComparable + { + // null, by definition is always less than or equal to + if (actual == null) + { + if (greaterThanOrEqualTo == null) + { + // We're equal + return; + } + else + { + // Null is always less than non-null + throw new XunitException(AddOptionalUserMessage($"Expected: to be greater than or equal to .", userMessage)); + } + } + + if (actual.CompareTo(greaterThanOrEqualTo) < 0) + throw new XunitException(AddOptionalUserMessage($"Expected: {actual} to be greater than or equal to {greaterThanOrEqualTo}", userMessage)); + } + + /// + /// Validates that the actual byte array is equal to the expected byte array. XUnit only displays the first 5 values + /// of each collection if the test fails. This doesn't display at what point or how the equality assertion failed. + /// + /// The byte array that should be equal to. + /// + public static void Equal(byte[] expected, byte[] actual) + { + try + { + Assert.Equal(expected, actual); + } + catch (EqualException) + { + string expectedString = string.Join(", ", expected); + string actualString = string.Join(", ", actual); + throw EqualException.ForMismatchedStrings(expectedString, actualString, 0, 0); + } + } + } +} diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/BaseProviderAsyncTest/BaseProviderAsyncTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/BaseProviderAsyncTest/BaseProviderAsyncTest.cs index 0d13ad5f77..d4019c0d10 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/BaseProviderAsyncTest/BaseProviderAsyncTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/BaseProviderAsyncTest/BaseProviderAsyncTest.cs @@ -19,21 +19,21 @@ private static void AssertTaskFaults(Task t) } [Fact] - public static void TestDbConnection() + public static async Task TestDbConnection() { MockConnection connection = new MockConnection(); CancellationTokenSource source = new CancellationTokenSource(); // ensure OpenAsync() calls OpenAsync(CancellationToken.None) AssertEqualsWithDescription(ConnectionState.Closed, connection.State, "Connection state should have been marked as Closed"); - connection.OpenAsync().Wait(); + await connection.OpenAsync(); Assert.False(connection.CancellationToken.CanBeCanceled, "Default cancellation token should not be cancellable"); AssertEqualsWithDescription(ConnectionState.Open, connection.State, "Connection state should have been marked as Open"); connection.Close(); // Verify cancellationToken over-ride AssertEqualsWithDescription(ConnectionState.Closed, connection.State, "Connection state should have been marked as Closed"); - connection.OpenAsync(source.Token).Wait(); + await connection.OpenAsync(source.Token); AssertEqualsWithDescription(ConnectionState.Open, connection.State, "Connection state should have been marked as Open"); connection.Close(); @@ -48,12 +48,12 @@ public static void TestDbConnection() // Verify base implementation does not call Open when passed an already cancelled cancellation token source.Cancel(); AssertEqualsWithDescription(ConnectionState.Closed, connection.State, "Connection state should have been marked as Closed"); - connection.OpenAsync(source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled).Wait(); + await connection.OpenAsync(source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled); AssertEqualsWithDescription(ConnectionState.Closed, connection.State, "Connection state should have been marked as Closed"); } [Fact] - public static void TestDbCommand() + public static async Task TestDbCommand() { MockCommand command = new MockCommand() { @@ -63,30 +63,30 @@ public static void TestDbCommand() CancellationTokenSource source = new CancellationTokenSource(); // Verify parameter routing and correct synchronous implementation is called - command.ExecuteNonQueryAsync().Wait(); + await command.ExecuteNonQueryAsync(); Assert.False(command.CancellationToken.CanBeCanceled, "Default cancellation token should not be cancellable"); AssertEqualsWithDescription("ExecuteNonQuery", command.LastCommand, "Last command was not as expected"); - command.ExecuteReaderAsync().Wait(); + await command.ExecuteReaderAsync(); AssertEqualsWithDescription(CommandBehavior.Default, command.CommandBehavior, "Command behavior should have been marked as Default"); Assert.False(command.CancellationToken.CanBeCanceled, "Default cancellation token should not be cancellable"); AssertEqualsWithDescription("ExecuteReader", command.LastCommand, "Last command was not as expected"); - command.ExecuteScalarAsync().Wait(); + await command.ExecuteScalarAsync(); Assert.False(command.CancellationToken.CanBeCanceled, "Default cancellation token should not be cancellable"); AssertEqualsWithDescription("ExecuteScalar", command.LastCommand, "Last command was not as expected"); - command.ExecuteNonQueryAsync(source.Token).Wait(); + await command.ExecuteNonQueryAsync(source.Token); AssertEqualsWithDescription("ExecuteNonQuery", command.LastCommand, "Last command was not as expected"); - command.ExecuteReaderAsync(source.Token).Wait(); + await command.ExecuteReaderAsync(source.Token); AssertEqualsWithDescription("ExecuteReader", command.LastCommand, "Last command was not as expected"); - command.ExecuteScalarAsync(source.Token).Wait(); + await command.ExecuteScalarAsync(source.Token); AssertEqualsWithDescription("ExecuteScalar", command.LastCommand, "Last command was not as expected"); - command.ExecuteReaderAsync(CommandBehavior.SequentialAccess).Wait(); + await command.ExecuteReaderAsync(CommandBehavior.SequentialAccess); AssertEqualsWithDescription(CommandBehavior.SequentialAccess, command.CommandBehavior, "Command behavior should have been marked as SequentialAccess"); Assert.False(command.CancellationToken.CanBeCanceled, "Default cancellation token should not be cancellable"); AssertEqualsWithDescription("ExecuteReader", command.LastCommand, "Last command was not as expected"); - command.ExecuteReaderAsync(CommandBehavior.SingleRow, source.Token).Wait(); + await command.ExecuteReaderAsync(CommandBehavior.SingleRow, source.Token); AssertEqualsWithDescription(CommandBehavior.SingleRow, command.CommandBehavior, "Command behavior should have been marked as SingleRow"); AssertEqualsWithDescription("ExecuteReader", command.LastCommand, "Last command was not as expected"); @@ -107,56 +107,55 @@ public static void TestDbCommand() // Verify base implementation does not call Open when passed an already cancelled cancellation token source.Cancel(); command.LastCommand = "Nothing"; - command.ExecuteNonQueryAsync(source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled).Wait(); + await command.ExecuteNonQueryAsync(source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled); AssertEqualsWithDescription("Nothing", command.LastCommand, "Expected last command to be 'Nothing'"); - command.ExecuteReaderAsync(source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled).Wait(); + await command.ExecuteReaderAsync(source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled); AssertEqualsWithDescription("Nothing", command.LastCommand, "Expected last command to be 'Nothing'"); - command.ExecuteReaderAsync(CommandBehavior.SequentialAccess, source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled).Wait(); + await command.ExecuteReaderAsync(CommandBehavior.SequentialAccess, source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled); AssertEqualsWithDescription("Nothing", command.LastCommand, "Expected last command to be 'Nothing'"); - command.ExecuteScalarAsync(source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled).Wait(); + await command.ExecuteScalarAsync(source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled); AssertEqualsWithDescription("Nothing", command.LastCommand, "Expected last command to be 'Nothing'"); // Verify cancellation command.WaitForCancel = true; source = new CancellationTokenSource(); - Task.Factory.StartNew(() => { command.WaitForWaitingForCancel(); source.Cancel(); }); + var task = Task.Factory.StartNew(() => { command.WaitForWaitingForCancel(); source.Cancel(); }); Task result = command.ExecuteNonQueryAsync(source.Token); Assert.True(result.Exception != null, "Task result should be faulted"); + await task; source = new CancellationTokenSource(); - Task.Factory.StartNew(() => { command.WaitForWaitingForCancel(); source.Cancel(); }); + task = Task.Factory.StartNew(() => { command.WaitForWaitingForCancel(); source.Cancel(); }); result = command.ExecuteReaderAsync(source.Token); Assert.True(result.Exception != null, "Task result should be faulted"); + await task; source = new CancellationTokenSource(); - Task.Factory.StartNew(() => { command.WaitForWaitingForCancel(); source.Cancel(); }); + task = Task.Factory.StartNew(() => { command.WaitForWaitingForCancel(); source.Cancel(); }); result = command.ExecuteScalarAsync(source.Token); Assert.True(result.Exception != null, "Task result should be faulted"); + await task; } [Fact] - public static void TestDbDataReader() + public static async Task TestDbDataReader() { var query = Enumerable.Range(1, 2).Select((x) => new object[] { x, x.ToString(), DBNull.Value }); MockDataReader reader = new MockDataReader { Results = query.GetEnumerator() }; CancellationTokenSource source = new CancellationTokenSource(); - Task result; - - result = reader.ReadAsync(); - result.Wait(); + var result = await reader.ReadAsync(); AssertEqualsWithDescription("Read", reader.LastCommand, "Last command was not as expected"); - Assert.True(result.Result, "Should have received a Result from the ReadAsync"); + Assert.True(result, "Should have received a Result from the ReadAsync"); Assert.False(reader.CancellationToken.CanBeCanceled, "Default cancellation token should not be cancellable"); GetFieldValueAsync(reader, 0, 1); Assert.False(reader.CancellationToken.CanBeCanceled, "Default cancellation token should not be cancellable"); GetFieldValueAsync(reader, source.Token, 1, "1"); - result = reader.ReadAsync(source.Token); - result.Wait(); + result = await reader.ReadAsync(source.Token); AssertEqualsWithDescription("Read", reader.LastCommand, "Last command was not as expected"); - Assert.True(result.Result, "Should have received a Result from the ReadAsync"); + Assert.True(result, "Should have received a Result from the ReadAsync"); GetFieldValueAsync(reader, 2, DBNull.Value); GetFieldValueAsync(reader, 2, DBNull.Value); @@ -165,18 +164,17 @@ public static void TestDbDataReader() AssertTaskFaults(reader.GetFieldValueAsync(2)); AssertEqualsWithDescription("GetValue", reader.LastCommand, "Last command was not as expected"); - result = reader.ReadAsync(); - result.Wait(); + result = await reader.ReadAsync(); AssertEqualsWithDescription("Read", reader.LastCommand, "Last command was not as expected"); - Assert.False(result.Result, "Should NOT have received a Result from the ReadAsync"); + Assert.False(result, "Should NOT have received a Result from the ReadAsync"); - result = reader.NextResultAsync(); + result = await reader.NextResultAsync(); AssertEqualsWithDescription("NextResult", reader.LastCommand, "Last command was not as expected"); - Assert.False(result.Result, "Should NOT have received a Result from NextResultAsync"); + Assert.False(result, "Should NOT have received a Result from NextResultAsync"); Assert.False(reader.CancellationToken.CanBeCanceled, "Default cancellation token should not be cancellable"); - result = reader.NextResultAsync(source.Token); + result = await reader.NextResultAsync(source.Token); AssertEqualsWithDescription("NextResult", reader.LastCommand, "Last command was not as expected"); - Assert.False(result.Result, "Should NOT have received a Result from NextResultAsync"); + Assert.False(result, "Should NOT have received a Result from NextResultAsync"); MockDataReader readerFail = new MockDataReader { Results = query.GetEnumerator(), Fail = true }; AssertTaskFaults(readerFail.ReadAsync()); @@ -188,11 +186,11 @@ public static void TestDbDataReader() source.Cancel(); reader.LastCommand = "Nothing"; - reader.ReadAsync(source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled).Wait(); + await reader.ReadAsync(source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled); AssertEqualsWithDescription("Nothing", reader.LastCommand, "Expected last command to be 'Nothing'"); - reader.NextResultAsync(source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled).Wait(); + await reader.NextResultAsync(source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled); AssertEqualsWithDescription("Nothing", reader.LastCommand, "Expected last command to be 'Nothing'"); - reader.GetFieldValueAsync(0, source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled).Wait(); + await reader.GetFieldValueAsync(0, source.Token).ContinueWith((t) => { }, TaskContinuationOptions.OnlyOnCanceled); AssertEqualsWithDescription("Nothing", reader.LastCommand, "Expected last command to be 'Nothing'"); } 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 fcc368dc8a..ef9c41a130 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 @@ -64,6 +64,17 @@ + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + @@ -91,9 +102,9 @@ TDS - + diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/PlatformDetection.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/PlatformDetection.cs new file mode 100644 index 0000000000..24b9e24b4f --- /dev/null +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/PlatformDetection.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace System +{ + public static partial class PlatformDetection + { + public static bool IsArmProcess => RuntimeInformation.ProcessArchitecture == Architecture.Arm; + public static bool IsNotArmProcess => !IsArmProcess; + public static bool IsX86Process => RuntimeInformation.ProcessArchitecture == Architecture.X86; + public static bool IsNotX86Process => !IsX86Process; + } +} diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlBulkCopyColumnMappingCollectionTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlBulkCopyColumnMappingCollectionTest.cs index 3ac3d8a279..109268871d 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlBulkCopyColumnMappingCollectionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlBulkCopyColumnMappingCollectionTest.cs @@ -420,7 +420,7 @@ public void InsertAndClear_BehavesAsExpected() Assert.Same(item3, list[2]); list.Clear(); - Assert.Equal(0, list.Count); + Assert.Empty(list); list.Add(item1); list.Add(item3); @@ -435,7 +435,7 @@ public void InsertAndClear_BehavesAsExpected() Assert.Same(item3, list[2]); list.Clear(); - Assert.Equal(0, list.Count); + Assert.Empty(list); } [Fact] @@ -463,12 +463,11 @@ public void Remove_BehavesAsExpected() IList list = CreateCollection(item1, item2); list.Remove(item1); - Assert.Equal(1, list.Count); + Assert.Single(list); Assert.Same(item2, list[0]); list.Remove(item2); - Assert.Equal(0, list.Count); - + Assert.Empty(list); AssertExtensions.Throws(null, () => list.Remove(item2)); AssertExtensions.Throws(null, () => list.Remove(new SqlBulkCopyColumnMapping(2, 2))); AssertExtensions.Throws(null, () => list.Remove("bogus")); @@ -504,11 +503,11 @@ public void RemoveAt_BehavesAsExpected() Assert.Same(item3, list[1]); list.RemoveAt(1); - Assert.Equal(1, list.Count); + Assert.Single(list); Assert.Same(item2, list[0]); list.RemoveAt(0); - Assert.Equal(0, list.Count); + Assert.Empty(list); } [Fact] diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlBulkCopyColumnOrderHintCollectionTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlBulkCopyColumnOrderHintCollectionTest.cs index b6104335dd..9cd30eb3f9 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlBulkCopyColumnOrderHintCollectionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlBulkCopyColumnOrderHintCollectionTest.cs @@ -395,7 +395,7 @@ public void InsertAndClear_BehavesAsExpected() Assert.Same(item3, list[2]); list.Clear(); - Assert.Equal(0, list.Count); + Assert.Empty(list); list.Add(item1); list.Add(item3); @@ -410,7 +410,7 @@ public void InsertAndClear_BehavesAsExpected() Assert.Same(item3, list[2]); list.Clear(); - Assert.Equal(0, list.Count); + Assert.Empty(list); } [Fact] @@ -434,12 +434,11 @@ public void Remove_BehavesAsExpected() IList list = CreateCollection(item1, item2); list.Remove(item1); - Assert.Equal(1, list.Count); + Assert.Single(list); Assert.Same(item2, list[0]); list.Remove(item2); - Assert.Equal(0, list.Count); - + Assert.Empty(list); AssertExtensions.Throws(null, () => list.Remove(item2)); AssertExtensions.Throws(null, () => list.Remove(new SqlBulkCopyColumnOrderHint("column4", SortOrder.Ascending))); AssertExtensions.Throws(null, () => list.Remove("bogus")); @@ -473,11 +472,11 @@ public void RemoveAt_BehavesAsExpected() Assert.Same(item2, list[0]); Assert.Same(item3, list[1]); list.RemoveAt(1); - Assert.Equal(1, list.Count); + Assert.Single(list); Assert.Same(item2, list[0]); list.RemoveAt(0); - Assert.Equal(0, list.Count); + Assert.Empty(list); } [Fact] diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConfigurableRetryLogicTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConfigurableRetryLogicTest.cs index f43162cab8..b04115b191 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConfigurableRetryLogicTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConfigurableRetryLogicTest.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Threading.Tasks; using Xunit; namespace Microsoft.Data.SqlClient.Tests @@ -10,7 +11,7 @@ namespace Microsoft.Data.SqlClient.Tests public class SqlConfigurableRetryLogicTest { [Fact] - public void InvalidExecute() + public async Task InvalidExecute() { SqlRetryLogicOption option = new SqlRetryLogicOption() { @@ -23,8 +24,8 @@ public void InvalidExecute() SqlRetryLogicBaseProvider retryLogicProvider = SqlConfigurableRetryFactory.CreateFixedRetryProvider(option); Assert.Throws(() => retryLogicProvider.Execute(null, null)); - Assert.ThrowsAsync(() => retryLogicProvider.ExecuteAsync(null, null)); - Assert.ThrowsAsync(() => retryLogicProvider.ExecuteAsync(null, null)); + await Assert.ThrowsAsync(() => retryLogicProvider.ExecuteAsync(null, null)); + await Assert.ThrowsAsync(() => retryLogicProvider.ExecuteAsync(null, null)); } [Fact] diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionBasicTests.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionBasicTests.cs index accb6f2201..21bf1d2d16 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionBasicTests.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionBasicTests.cs @@ -37,7 +37,7 @@ public void ConnectionTest() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotArmProcess))] - [ActiveIssue(4830, TestPlatforms.AnyUnix)] + [ActiveIssue("4830", TestPlatforms.AnyUnix)] [PlatformSpecific(TestPlatforms.Windows)] public void IntegratedAuthConnectionTest() { @@ -94,7 +94,7 @@ public void TransientFaultTest(uint errorCode) { Assert.Equal(ConnectionState.Closed, connection.State); } - Assert.False(true, e.Message); + Assert.Fail(e.Message); } } diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.RetrieveStatistics.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.RetrieveStatistics.cs index 6e08b3e91d..d4fff6473c 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.RetrieveStatistics.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.RetrieveStatistics.cs @@ -181,13 +181,8 @@ public void RetrieveStatistics_Clear_Success() d.Clear(); Assert.Empty(d); - Assert.Equal(0, d.Count); - Assert.Empty(d.Keys); - Assert.Equal(0, d.Keys.Count); - Assert.Empty(d.Values); - Assert.Equal(0, d.Values.Count); } [Fact] diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlDataRecordTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlDataRecordTest.cs index 77546de525..7808202931 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlDataRecordTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlDataRecordTest.cs @@ -70,7 +70,7 @@ public void SqlRecordFillTest() char[] expectedValue = new char[] { 'a', 'b', 'e', 'f', 'g' }; Assert.Equal(expectedValue.Length, record.GetChars(3, 0, cb2, 0, 5)); - Assert.Equal(expectedValue, new string(cb2, 0, (int)record.GetChars(3, 0, null, 0, 0))); + Assert.Equal(expectedValue, new string(cb2, 0, (int)record.GetChars(3, 0, null, 0, 0)).ToCharArray()); record.SetString(3, ""); string xyz = "xyz"; diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlErrorTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlErrorTest.cs index 13b78449f4..c8264eb446 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlErrorTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlErrorTest.cs @@ -33,7 +33,7 @@ public static void SqlErrorSerializationTest() } catch (Exception ex) { - Assert.False(true, $"Unexpected Exception occurred: {ex.Message}"); + Assert.Fail($"Unexpected Exception occurred: {ex.Message}"); } } diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlHelperTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlHelperTest.cs index 087e5b5c57..44286b8c0e 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlHelperTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlHelperTest.cs @@ -50,7 +50,7 @@ void handleUnobservedException(object o, UnobservedTaskExceptionEventArgs a) if (unobservedExceptionHappend) //Save doing string interpolation in the happy case { var e = UnwrapException(unhandledException); - Assert.False(true, $"Did not expect an unobserved exception, but found a {e?.GetType()} with message \"{e?.Message}\""); + Assert.Fail($"Did not expect an unobserved exception, but found a {e?.GetType()} with message \"{e?.Message}\""); } } finally 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 0c22396401..744cec85e6 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 @@ -279,7 +279,6 @@ - @@ -288,6 +287,16 @@ Common\System\Collections\DictionaryExtensions.cs + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + Address @@ -301,9 +310,9 @@ Utf8String - + @@ -325,7 +334,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTest.cs index 080a66b394..8208f7e496 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTest.cs @@ -10,7 +10,7 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests { public static class AsyncTest { - [ActiveIssue(5533)] // Async Operations slower than Sync operations + [ActiveIssue("5533")] // Async Operations slower than Sync operations [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] public static void TestReadAsyncTimeConsumed() { 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 8a50cb8ae1..b3c8995e8f 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs @@ -575,7 +575,7 @@ public static void ADInteractiveUsingSSPI() // Test passes locally everytime, but in pieplines fails randomly with uncertainity. // e.g. Second AAD connection too slow (802ms)! (More than 30% of the first (576ms).) - [ActiveIssue(16058)] + [ActiveIssue("16058")] [ConditionalFact(nameof(IsAADConnStringsSetup))] public static void ConnectionSpeed() { 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 e622121cbb..34557a8e90 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs @@ -31,7 +31,7 @@ public static void RunAllTestsForSingleServer_NP() } } - [ActiveIssue(5540)] + [ActiveIssue("5540")] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] public static void RunAllTestsForSingleServer_TCP() { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs index 97243d4abd..a58764f51e 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs @@ -144,7 +144,7 @@ public void NamedPipeInvalidConnStringTest() } [Fact] - [SkipOnTargetFramework(~TargetFrameworkMonikers.Uap)] + [SkipOnTargetFramework(~(TargetFrameworkMonikers)0x4)] public static void LocalDBNotSupportedOnUapTest() { SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(@$"server=(localdb)\{DataTestUtility.LocalDbAppName}") diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/IntegratedAuthenticationTest/IntegratedAuthenticationTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/IntegratedAuthenticationTest/IntegratedAuthenticationTest.cs index 654d020742..e043b2253c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/IntegratedAuthenticationTest/IntegratedAuthenticationTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/IntegratedAuthenticationTest/IntegratedAuthenticationTest.cs @@ -30,7 +30,7 @@ public static void IntegratedAuthenticationTestWithOutConnectionPooling() TryOpenConnectionWithIntegratedAuthentication(builder.ConnectionString); } - [ActiveIssue(21707)] + [ActiveIssue("21707")] [ConditionalFact(nameof(IsIntegratedSecurityEnvironmentSet), nameof(AreConnectionStringsSetup))] public static void IntegratedAuthenticationTest_InvalidServerSPN() { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs index 60e9b293f3..f0f15c20cb 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs @@ -27,14 +27,14 @@ private enum InfoType private static readonly string s_localDbNamedPipeConnectionString = @$"server={GetLocalDbNamedPipe()}"; #region LocalDbTests - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // No Registry support on UAP + [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP [ConditionalFact(nameof(IsLocalDBEnvironmentSet))] public static void SqlLocalDbConnectionTest() { ConnectionTest(s_localDbConnectionString); } - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // No Registry support on UAP + [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP [ConditionalFact(nameof(IsLocalDBEnvironmentSet))] public static void LocalDBEncryptionNotSupportedTest() { @@ -43,7 +43,7 @@ public static void LocalDBEncryptionNotSupportedTest() ConnectionWithEncryptionTest(s_localDbConnectionString); } - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // No Registry support on UAP + [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP [ConditionalFact(nameof(IsLocalDBEnvironmentSet))] public static void LocalDBMarsTest() { @@ -51,7 +51,7 @@ public static void LocalDBMarsTest() ConnectionWithMarsTest(s_localDbConnectionString); } - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // No Registry support on UAP + [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP [ConditionalFact(nameof(IsLocalDBEnvironmentSet))] public static void InvalidLocalDBTest() { @@ -61,7 +61,7 @@ public static void InvalidLocalDBTest() #endregion #region SharedLocalDb tests - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // No Registry support on UAP + [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP [ConditionalFact(nameof(IsLocalDbSharedInstanceSet))] public static void SharedLocalDbEncryptionTest() { @@ -73,7 +73,7 @@ public static void SharedLocalDbEncryptionTest() } } - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // No Registry support on UAP + [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP [ConditionalFact(nameof(IsLocalDbSharedInstanceSet))] public static void SharedLocalDbMarsTest() { @@ -83,7 +83,7 @@ public static void SharedLocalDbMarsTest() } } - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // No Registry support on UAP + [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP [ConditionalFact(nameof(IsLocalDbSharedInstanceSet))] public static void SqlLocalDbSharedInstanceConnectionTest() { @@ -97,16 +97,16 @@ public static void SqlLocalDbSharedInstanceConnectionTest() #region NamedPipeTests [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // No Registry support on UAP - [ActiveIssue(20245)] //pending pipeline configuration + [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP + [ActiveIssue("20245")] //pending pipeline configuration public static void SqlLocalDbNamedPipeConnectionTest() { ConnectionTest(s_localDbNamedPipeConnectionString); } [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // No Registry support on UAP - [ActiveIssue(20245)] //pending pipeline configuration + [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP + [ActiveIssue("20245")] //pending pipeline configuration public static void LocalDBNamedPipeEncryptionNotSupportedTest() { // Encryption is not supported by SQL Local DB. @@ -115,8 +115,8 @@ public static void LocalDBNamedPipeEncryptionNotSupportedTest() } [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // No Registry support on UAP - [ActiveIssue(20245)] //pending pipeline configuration + [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP + [ActiveIssue("20245")] //pending pipeline configuration public static void LocalDBNamepipeMarsTest() { ConnectionWithMarsTest(s_localDbNamedPipeConnectionString); @@ -126,7 +126,7 @@ public static void LocalDBNamepipeMarsTest() #region Failures // ToDo: After adding shared memory support on managed SNI, the IsNativeSNI could be taken out - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // No Registry support on UAP + [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP [ConditionalTheory(nameof(IsLocalDBEnvironmentSet), nameof(IsNativeSNI))] [InlineData("lpc:")] public static void SharedMemoryAndSqlLocalDbConnectionTest(string prefix) @@ -137,7 +137,7 @@ public static void SharedMemoryAndSqlLocalDbConnectionTest(string prefix) Assert.Contains("A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 41 - Cannot open a Shared Memory connection to a remote SQL server)", ex.Message); } - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // No Registry support on UAP + [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP [InlineData("tcp:")] [InlineData("np:")] [InlineData("undefinded:")] @@ -150,7 +150,7 @@ public static void PrefixAndSqlLocalDbConnectionTest(string prefix) Assert.Contains("A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)", ex.Message); } - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // No Registry support on UAP + [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP [ConditionalFact(nameof(IsLocalDBEnvironmentSet))] public static void InvalidSqlLocalDbConnectionTest() { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/MARSSessionPoolingTest/MARSSessionPoolingTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/MARSSessionPoolingTest/MARSSessionPoolingTest.cs index b205ee0af2..4de06aeda3 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/MARSSessionPoolingTest/MARSSessionPoolingTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/MARSSessionPoolingTest/MARSSessionPoolingTest.cs @@ -67,7 +67,7 @@ public static void MarsExecuteReader_RPC_NoGC() } // Synapse: Catalog view 'dm_exec_connections' is not supported in this version. - [ActiveIssue(11167)] + [ActiveIssue("11167")] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))] public static void MarsExecuteReader_Text_WithGC() { @@ -76,7 +76,7 @@ public static void MarsExecuteReader_Text_WithGC() } // Synapse: Stored procedure sp_who does not exist or is not supported. - [ActiveIssue(8959)] + [ActiveIssue("8959")] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))] public static void MarsExecuteReader_StoredProcedure_WithGC() { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs index 7a13fdceb5..0383fa37d3 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs @@ -53,7 +53,7 @@ public void TestMain() } [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer))] - [ActiveIssue(5531)] + [ActiveIssue("5531")] public void TestPacketNumberWraparound() { // this test uses a specifically crafted sql record enumerator and data to put the TdsParserStateObject.WritePacket(byte,bool) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlCommandReliabilityTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlCommandReliabilityTest.cs index dc467e3775..cd3aa3e8cc 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlCommandReliabilityTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlCommandReliabilityTest.cs @@ -107,7 +107,7 @@ public void RetryExecuteCancel(string cnnString, SqlRetryLogicBaseProvider provi } } - [ActiveIssue(14588)] + [ActiveIssue("14588")] [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.IsNotAzureSynapse), nameof(DataTestUtility.AreConnStringsSetup))] [MemberData(nameof(RetryLogicTestHelper.GetConnectionAndRetryStrategyInvalidCommand), parameters: new object[] { 5 }, MemberType = typeof(RetryLogicTestHelper), DisableDiscoveryEnumeration = true)] public void RetryExecuteWithTransScope(string cnnString, SqlRetryLogicBaseProvider provider) @@ -233,7 +233,7 @@ public void RetryExecuteUnauthorizedSqlStatementDML(string cnnString, SqlRetryLo } } - [ActiveIssue(14325)] + [ActiveIssue("14325")] // avoid creating a new database in Azure [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.IsNotAzureServer), nameof(DataTestUtility.IsNotAzureSynapse), nameof(DataTestUtility.AreConnStringsSetup))] [MemberData(nameof(RetryLogicTestHelper.GetConnectionAndRetryStrategyDropDB), parameters: new object[] { 5 }, MemberType = typeof(RetryLogicTestHelper), DisableDiscoveryEnumeration = true)] diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlConnectionReliabilityTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlConnectionReliabilityTest.cs index d6f1e39f77..301ed95d74 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlConnectionReliabilityTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlConnectionReliabilityTest.cs @@ -51,7 +51,7 @@ public void ConnectionCancelRetryOpenInvalidCatalog(string cnnString, SqlRetryLo } } - [ActiveIssue(14590, TestPlatforms.Windows)] + [ActiveIssue("14590", TestPlatforms.Windows)] // avoid creating a new database in Azure [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.IsNotAzureServer), nameof(DataTestUtility.IsNotAzureSynapse), nameof(DataTestUtility.AreConnStringsSetup))] [MemberData(nameof(RetryLogicTestHelper.GetConnectionAndRetryStrategyLongRunner), parameters: new object[] { 10 }, MemberType = typeof(RetryLogicTestHelper), DisableDiscoveryEnumeration = true)] @@ -100,7 +100,7 @@ public void CreateDatabaseWhileTryingToConnect(string cnnString, SqlRetryLogicBa Assert.True(currentRetries > 0); } - [ActiveIssue(25147)] + [ActiveIssue("25147")] [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] [MemberData(nameof(RetryLogicTestHelper.GetConnectionAndRetryStrategyInvalidCatalog), parameters: new object[] { 2 }, MemberType = typeof(RetryLogicTestHelper), DisableDiscoveryEnumeration = true)] public void ConcurrentExecution(string cnnString, SqlRetryLogicBaseProvider provider) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SplitPacketTest/SplitPacketTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SplitPacketTest/SplitPacketTest.cs index 4d4313a000..1147e704ca 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SplitPacketTest/SplitPacketTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SplitPacketTest/SplitPacketTest.cs @@ -11,7 +11,7 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests { - [ActiveIssue(5538)] // Only testable on localhost + [ActiveIssue("5538")] // Only testable on localhost public class SplitPacketTest { private int Port = -1; diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/SqlBulkCopyTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/SqlBulkCopyTest.cs index e720ff96f1..f7cb3e7490 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/SqlBulkCopyTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/SqlBulkCopyTest.cs @@ -297,7 +297,7 @@ public void OrderHintTransactionTest() } [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] - [ActiveIssue(12219)] + [ActiveIssue("12219")] public void OrderHintIdentityColumnTest() { OrderHintIdentityColumn.Test(_connStr, AddGuid("SqlBulkCopyTest_OrderHintIdentityColumn")); diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandCancelTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandCancelTest.cs index 601bffa42a..bbb05ccc5f 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandCancelTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandCancelTest.cs @@ -157,7 +157,7 @@ public static void TimeoutCancel() TimeoutCancel(tcp_connStr); } - [ActiveIssue(12167)] + [ActiveIssue("12167")] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer))] [PlatformSpecific(TestPlatforms.Windows)] public static void TimeoutCancelNP() @@ -178,14 +178,14 @@ public static void CancelAndDisposePreparedCommandNP() CancelAndDisposePreparedCommand(np_connStr); } - [ActiveIssue(5541)] + [ActiveIssue("5541")] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] public static void TimeOutDuringRead() { TimeOutDuringRead(tcp_connStr); } - [ActiveIssue(5541)] + [ActiveIssue("5541")] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer))] [PlatformSpecific(TestPlatforms.Windows)] public static void TimeOutDuringReadNP() 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 11827aa15f..ed7c5b5b8a 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlNotificationTest/SqlNotificationTest.cs @@ -226,7 +226,7 @@ public void Test_SingleDependency_CustomQueue_SqlAuth() /// /// SqlDependecy premature timeout /// - [ActiveIssue(5539)] + [ActiveIssue("5539")] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] public void Test_SingleDependency_Timeout() { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtBulkCopyTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtBulkCopyTest.cs index 5f17036b4f..469c895a61 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtBulkCopyTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtBulkCopyTest.cs @@ -11,7 +11,7 @@ public class UdtBulkCopyTest { private string _connStr; - [ActiveIssue(5535)] + [ActiveIssue("5535")] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.IsUdtTestDatabasePresent), nameof(DataTestUtility.AreConnStringsSetup))] public void RunCopyTest() { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest2.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest2.cs index ef38e43dda..6a20db8c5f 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest2.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest2.cs @@ -11,7 +11,7 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests { - [ActiveIssue(5536)] + [ActiveIssue("5536")] // TODO Synapse: Remove dependency from UDTTest Database public class UdtTest2 { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/WeakRefTestYukonSpecific/WeakRefTestYukonSpecific.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/WeakRefTestYukonSpecific/WeakRefTestYukonSpecific.cs index 5835bb9e69..bf0567df82 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/WeakRefTestYukonSpecific/WeakRefTestYukonSpecific.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/WeakRefTestYukonSpecific/WeakRefTestYukonSpecific.cs @@ -17,7 +17,7 @@ public static class WeakRefTestYukonSpecific private const int CONCURRENT_COMMANDS = 5; // TODO Synapse: Remove dependency on Northwind database - [ActiveIssue(6643, TestPlatforms.AnyUnix)] + [ActiveIssue("6643", TestPlatforms.AnyUnix)] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))] public static void TestReaderMars() { 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 ab120d549f..7219ca2c8b 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 @@ -7,6 +7,7 @@ + diff --git a/tools/props/Versions.props b/tools/props/Versions.props index 0aca13245e..c71f1357f5 100644 --- a/tools/props/Versions.props +++ b/tools/props/Versions.props @@ -1,7 +1,7 @@ - 5.1.7 + 5.1.8 0 $(MdsVersionDefault).$(BuildNumber) $(AssemblyFileVersion) @@ -27,8 +27,8 @@ - 1.11.4 - 4.61.3 + 1.12.1 + 4.78.0 6.35.0 6.35.0 4.5.1 @@ -55,27 +55,30 @@ - [1.38.0,2.0.0) - [4.4.0,5.0.0) + 1.45.0 + 4.7.0 6.0.3 3.1.6 - 17.4.1 + 17.12.0 13.0.1 4.3.0 6.0.1 + 6.0.1 5.0.0 - 2.4.2 - 2.4.5 - 7.0.0-beta.22316.1 + 2.9.3 + 2.8.2 + 11.0.0-beta.25476.3 + 11.0.0-beta.25476.3 2.0.8 - 170.8.0 + 172.52.0 10.50.1600.1 0.13.2 6.0.0 6.0.1 + 1.0.3 $(NugetPackageVersion) From 2e701d800f8d4066893a3738cc4bb2d3eda2d28f Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 10 Nov 2025 12:02:56 -0400 Subject: [PATCH 02/13] User Story 40114: Release activities for v5.1.8 - Fixed build issues that only appear when building on Windows. --- src/Directory.Build.props | 7 +++++++ ...lient.AlwaysEncrypted.AzureKeyVaultProvider.csproj | 1 + .../netcore/ref/Microsoft.Data.SqlClient.csproj | 4 +--- .../netcore/src/Microsoft.Data.SqlClient.csproj | 4 +--- .../netfx/ref/Microsoft.Data.SqlClient.csproj | 1 + .../netfx/src/Microsoft.Data.SqlClient.csproj | 11 ++++++----- .../Microsoft.Data.SqlClient.Tests.csproj | 1 + .../tests/FunctionalTests/SqlExceptionTest.cs | 2 +- .../tests/ManualTests/AlwaysEncrypted/AKVUnitTests.cs | 2 +- .../tests/ManualTests/AlwaysEncrypted/ApiShould.cs | 2 +- .../ManualTests/AlwaysEncrypted/ConversionTests.cs | 4 ++-- .../ManualTests/AlwaysEncrypted/End2EndSmokeTests.cs | 2 +- .../AlwaysEncrypted/TestFixtures/DatabaseHelper.cs | 2 +- .../tests/ManualTests/DataCommon/DataTestUtility.cs | 8 +++++--- ...icrosoft.Data.SqlClient.ManualTesting.Tests.csproj | 1 + .../ManualTests/SQL/AsyncTest/AsyncTimeoutTest.cs | 2 +- .../ManualTests/SQL/AsyncTest/XmlReaderAsyncTest.cs | 2 +- .../SQL/ConnectivityTests/AADConnectionTest.cs | 2 ++ .../SQL/ConnectivityTests/ConnectivityTest.cs | 2 +- .../ManualTests/SQL/DataReaderTest/DataReaderTest.cs | 2 +- .../ManualTests/SQL/DataStreamTest/DataStreamTest.cs | 6 +++--- .../tests/ManualTests/SQL/MARSTest/MARSTest.cs | 2 +- .../ManualTests/SQL/ParameterTest/ParametersTest.cs | 4 ++-- .../tests/ManualTests/SQL/ParameterTest/TvpTest.cs | 4 ++-- .../SQL/RetryLogic/RetryLogicCounterTest.cs | 4 ++-- .../SQL/SqlCommand/SqlCommandCancelTest.cs | 2 +- .../SQL/SqlDependencyTest/SqlDependencyTest.cs | 4 ++-- .../SQL/TransactionTest/TransactionEnlistmentTest.cs | 2 +- .../Microsoft.Cci.Extensions.csproj | 2 +- tools/props/Versions.props | 3 ++- 30 files changed, 54 insertions(+), 41 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 20936f7e15..d99e265379 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -110,4 +110,11 @@ false + + + $(NoWarn);NETSDK1138 + diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj b/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj index ca570955ca..d68e3ee661 100644 --- a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj +++ b/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj @@ -31,6 +31,7 @@ + diff --git a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj index 912d68f5de..d57f2ab31a 100644 --- a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj @@ -35,9 +35,6 @@ - - - @@ -59,6 +56,7 @@ + diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj index f06bc9df7b..9f4bd23ad4 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -948,9 +948,6 @@ - - - @@ -973,6 +970,7 @@ + diff --git a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj index ba22087d50..a13e9a0a67 100644 --- a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj @@ -39,6 +39,7 @@ + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index 973dea69d6..4b711dc61d 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -1,10 +1,11 @@  - - + {407890AC-9876-4FEF-A6F1-F36A876BAADE} SqlClient - v4.6.2 + net462 + false + false true Strings SqlClient.Resources.$(ResxFileName) @@ -27,7 +28,7 @@ True True False - 1701,1702 + $(NoWarn);1701,1702 True True 4 @@ -713,6 +714,7 @@ + @@ -729,7 +731,6 @@ - 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 ef9c41a130..ad19a2dc4c 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 @@ -82,6 +82,7 @@ + diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs index 71975db7a5..204ab379c1 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs @@ -50,7 +50,7 @@ public static void SqlExcpetionSerializationTest() } catch (Exception ex) { - Assert.False(true, $"Unexpected Exception occurred: {ex.Message}"); + Assert.Fail($"Unexpected Exception occurred: {ex.Message}"); } } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/AKVUnitTests.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/AKVUnitTests.cs index ed7061cf65..2111c7a1af 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/AKVUnitTests.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/AKVUnitTests.cs @@ -64,7 +64,7 @@ private static void ValidateAKVTraces(List eventData, Gui } break; default: - Assert.False(true, "Unexpected event occurred: " + item.Message); + Assert.Fail("Unexpected event occurred: " + item.Message); break; } }); diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ApiShould.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ApiShould.cs index b987bdbc99..3c487b532c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ApiShould.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ApiShould.cs @@ -2918,7 +2918,7 @@ private void EndExecuteReaderAsyncCallBack(IAsyncResult asyncResult) catch (Exception e) { testAsyncCallBackStateObject.Completion.SetException(e); - Assert.True(false, $"{e.Message}"); + Assert.Fail($"{e.Message}"); } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ConversionTests.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ConversionTests.cs index a7be11add4..726bd5d82f 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ConversionTests.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ConversionTests.cs @@ -525,7 +525,7 @@ List GenerateOutOfRangeValuesForType(SqlDbType type, int length list.Add(new ValueErrorTuple(Single.Epsilon, false)); break; default: - Assert.True(false, "We should never get here"); + Assert.Fail("We should never get here"); break; } @@ -563,7 +563,7 @@ private void ExecuteAndCheckForError(SqlCommand sqlCmd, bool expectError) try { sqlCmd.ExecuteNonQuery(); - Assert.True(false, "We should have gotten an error but passed instead."); + Assert.Fail("We should have gotten an error but passed instead."); } catch (Exception e) { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/End2EndSmokeTests.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/End2EndSmokeTests.cs index ea4b0171eb..874c225d9f 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/End2EndSmokeTests.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/End2EndSmokeTests.cs @@ -106,7 +106,7 @@ public void TestSelectOnEncryptedNonEncryptedColumnsWithEncryptedParameters(stri break; default: - Assert.True(false, "FAILED: No other data type is supported."); + Assert.Fail("FAILED: No other data type is supported."); break; } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/DatabaseHelper.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/DatabaseHelper.cs index 86fa2c38c5..459573606e 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/DatabaseHelper.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/DatabaseHelper.cs @@ -186,7 +186,7 @@ public static void CompareResults(SqlDataReader sqlDataReader, string[] paramete break; #endif default: - Assert.True(false, "FAILED: unexpected data type."); + Assert.Fail("FAILED: unexpected data type."); break; } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs index 51acea439c..212655d373 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs @@ -224,7 +224,9 @@ private static Task AcquireTokenAsync(string authorityURL, string userID SecureString securePassword = new SecureString(); securePassword.MakeReadOnly(); + #pragma warning disable CS0618 // Type or member is obsolete result = app.AcquireTokenByUsernamePassword(scopes, userID, password).ExecuteAsync().Result; + #pragma warning restore CS0618 // Type or member is obsolete return result.AccessToken; }); @@ -787,7 +789,7 @@ public static TException ExpectFailure(Action actionThatFails, strin try { actionThatFails(); - Assert.False(true, "ERROR: Did not get expected exception"); + Assert.Fail("ERROR: Did not get expected exception"); return null; } catch (Exception ex) @@ -808,7 +810,7 @@ public static TException ExpectFailure(Action actio try { actionThatFails(); - Assert.False(true, "ERROR: Did not get expected exception"); + Assert.Fail("ERROR: Did not get expected exception"); return null; } catch (Exception ex) @@ -829,7 +831,7 @@ public static TException ExpectFailure + diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTimeoutTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTimeoutTest.cs index b516fa1a11..14abfea409 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTimeoutTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTimeoutTest.cs @@ -174,7 +174,7 @@ private static async Task QueryAndValidate(AsyncAPI api, int index, string delay } catch (Exception ex) { - Assert.False(true, "Exception occurred: " + ex.Message); + Assert.Fail("Exception occurred: " + ex.Message); } } break; diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/XmlReaderAsyncTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/XmlReaderAsyncTest.cs index 9d425b1b75..af5045e6ad 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/XmlReaderAsyncTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/XmlReaderAsyncTest.cs @@ -89,7 +89,7 @@ public static async void MoveToContentAsyncTest() } catch (Exception ex) { - Assert.False(true, "Exception occurred: " + ex.Message); + Assert.Fail("Exception occurred: " + ex.Message); } } } 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 b3c8995e8f..15f90bbc91 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs @@ -38,7 +38,9 @@ public override async Task AcquireTokenAsync(SqlAuthenti string[] scopes = new string[] { scope }; SecureString password = new SecureString(); + #pragma warning disable CS0618 // Type or member is obsolete AuthenticationResult result = await PublicClientApplicationBuilder.Create(_appClientId) + #pragma warning restore CS0618 // Type or member is obsolete .WithAuthority(parameters.Authority) .Build().AcquireTokenByUsernamePassword(scopes, parameters.UserId, parameters.Password) .WithCorrelationId(parameters.ConnectionId) 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 57d6725ce5..9a974ea341 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/ConnectivityTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/ConnectivityTest.cs @@ -85,7 +85,7 @@ public static void EnvironmentHostNameSPIDTest() // Confirm Server Process Id stays the same after query execution Assert.Equal(sessionSpid, sqlConnection.ServerProcessId); } - Assert.True(false, "No non-empty hostname found for the application"); + Assert.Fail("No non-empty hostname found for the application"); } [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs index 0aaaaf890d..0eb1a95935 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs @@ -159,7 +159,7 @@ public static void CollatedDataReaderTest() } catch (SqlException e) { - Assert.True(false, $"Unexpected Exception occurred: {e.Message}"); + Assert.Fail($"Unexpected Exception occurred: {e.Message}"); } finally { 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 34557a8e90..5bc0c8a7d7 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs @@ -106,17 +106,17 @@ static async Task LocalCopyTo(Stream source, Stream destination, int bufferSize, int sharedLength = Math.Min(inputData.Length, outputData.Length); if (sharedLength < outputData.Length) { - Assert.False(true, $"output is longer than input, input={inputData.Length} bytes, output={outputData.Length} bytes"); + Assert.Fail($"output is longer than input, input={inputData.Length} bytes, output={outputData.Length} bytes"); } if (sharedLength < inputData.Length) { - Assert.False(true, $"input is longer than output, input={inputData.Length} bytes, output={outputData.Length} bytes"); + Assert.Fail($"input is longer than output, input={inputData.Length} bytes, output={outputData.Length} bytes"); } for (int index = 0; index < sharedLength; index++) { if (inputData[index] != outputData[index]) // avoid formatting the output string unless there is a difference { - Assert.True(false, $"input and output differ at index {index}, input={inputData[index]}, output={outputData[index]}"); + Assert.Fail($"input and output differ at index {index}, input={inputData[index]}, output={outputData[index]}"); } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/MARSTest/MARSTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/MARSTest/MARSTest.cs index 5d28c1b0f3..b0f18a3ab0 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/MARSTest/MARSTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/MARSTest/MARSTest.cs @@ -688,7 +688,7 @@ FROM [{table}] AS [l] } catch (Exception e) { - Assert.False(true, "CRITIAL: Test should not fail randomly. Exception occurred: " + e.Message); + Assert.Fail("CRITIAL: Test should not fail randomly. Exception occurred: " + e.Message); } finally { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/ParametersTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/ParametersTest.cs index 6136f0bfc1..3d15953fcd 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/ParametersTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/ParametersTest.cs @@ -761,7 +761,7 @@ public static void ClosedConnection_SqlParameterValueTest() } catch (Exception e) { - Assert.False(true, $"Unexpected exception occurred: {e.Message}"); + Assert.Fail($"Unexpected exception occurred: {e.Message}"); } } }); @@ -804,7 +804,7 @@ private static void RunParameterTest() return; else if ((Guid)cm.Parameters["@id2"].Value != expectedGuid) { - Assert.False(true, "CRITICAL : Unexpected data found in SqlCommand parameters, this is a MAJOR issue."); + Assert.Fail("CRITICAL : Unexpected data found in SqlCommand parameters, this is a MAJOR issue."); } } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs index 0383fa37d3..b8882b451a 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs @@ -120,7 +120,7 @@ public void TestConnectionIsSafeToReuse() cmd.CommandTimeout = 100; AddCommandParameters(cmd, parameters); new SqlDataAdapter(cmd).Fill(new("BadFunc")); - Assert.False(true, "Expected exception did not occur"); + Assert.Fail("Expected exception did not occur"); } catch (Exception e) { @@ -140,7 +140,7 @@ public void TestConnectionIsSafeToReuse() } catch (Exception e) { - Assert.False(true, $"Unexpected error occurred: {e.Message}"); + Assert.Fail($"Unexpected error occurred: {e.Message}"); } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/RetryLogicCounterTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/RetryLogicCounterTest.cs index b62f2f1f53..e451091315 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/RetryLogicCounterTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/RetryLogicCounterTest.cs @@ -53,7 +53,7 @@ public async void ValidateRetryCount_SqlCommand_Async(string methodName, int num default: break; } - Assert.False(true, "Exception did not occur."); + Assert.Fail("Exception did not occur."); } catch { @@ -103,7 +103,7 @@ public void ValidateRetryCount_SqlCommand_Sync(string methodName, int numOfTries default: break; } - Assert.False(true, "Exception did not occur."); + Assert.Fail("Exception did not occur."); } catch { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandCancelTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandCancelTest.cs index bbb05ccc5f..0928a71569 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandCancelTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandCancelTest.cs @@ -306,7 +306,7 @@ IF EXISTS (SELECT name FROM msdb.dbo.sysalerts WHERE name = N'{alertName}') { if (retryAttempt >= 3 || e.Message.Contains("The transaction operation cannot be performed")) { - Assert.False(true, $"Retry Attempt: {retryAttempt} | Unexpected Exception occurred: {e.Message}"); + Assert.Fail($"Retry Attempt: {retryAttempt} | Unexpected Exception occurred: {e.Message}"); } else { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlDependencyTest/SqlDependencyTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlDependencyTest/SqlDependencyTest.cs index 38cd77a89e..c2a4ab79e8 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlDependencyTest/SqlDependencyTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlDependencyTest/SqlDependencyTest.cs @@ -122,7 +122,7 @@ public void SqlDependencyStartStopTest() } catch (Exception e) { - Assert.True(false, e.Message); + Assert.Fail(e.Message); } } @@ -152,7 +152,7 @@ public void SqlDependencyStartStopDefaultTest() } catch (Exception e) { - Assert.True(false, e.Message); + Assert.Fail(e.Message); } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionEnlistmentTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionEnlistmentTest.cs index ade9f41844..30244df808 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionEnlistmentTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionEnlistmentTest.cs @@ -62,7 +62,7 @@ public static void TestEnlistmentPrepare_TxScopeComplete() connection.Open(); System.Transactions.Transaction.Current.EnlistDurable(EnlistmentForPrepare.s_id, new EnlistmentForPrepare(), EnlistmentOptions.None); txScope.Complete(); - Assert.False(true, "Expected exception not thrown."); + Assert.Fail("Expected exception not thrown."); }); } diff --git a/tools/GenAPI/Microsoft.Cci.Extensions/Microsoft.Cci.Extensions.csproj b/tools/GenAPI/Microsoft.Cci.Extensions/Microsoft.Cci.Extensions.csproj index 299e6c19ab..5d55385f1d 100644 --- a/tools/GenAPI/Microsoft.Cci.Extensions/Microsoft.Cci.Extensions.csproj +++ b/tools/GenAPI/Microsoft.Cci.Extensions/Microsoft.Cci.Extensions.csproj @@ -11,7 +11,7 @@ - NU1701 + $(NoWarn);NU1701 $(DefineConstants);COREFX diff --git a/tools/props/Versions.props b/tools/props/Versions.props index c71f1357f5..e166006cdf 100644 --- a/tools/props/Versions.props +++ b/tools/props/Versions.props @@ -58,6 +58,7 @@ 1.45.0 4.7.0 6.0.3 + 4.3.2 @@ -70,7 +71,7 @@ 5.0.0 2.9.3 2.8.2 - 11.0.0-beta.25476.3 + 8.0.0-beta.25555.2 11.0.0-beta.25476.3 2.0.8 172.52.0 From 83f39437d70d1174d81268f2ecf69f924d52807d Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 10 Nov 2025 12:10:50 -0400 Subject: [PATCH 03/13] User Story 40114: Release activities for v5.1.8 - Removed ancient obsolete copy of XunitExtensions project. --- build.proj | 2 - .../Microsoft.Data.SqlClient.Tests.csproj | 3 - ....Data.SqlClient.ManualTesting.Tests.csproj | 3 - .../Attributes/ActiveIssueAttribute.cs | 24 -- .../Attributes/ConditionalClassAttribute.cs | 23 -- .../Attributes/ConditionalFactAttribute.cs | 28 -- .../Attributes/ConditionalTheoryAttribute.cs | 28 -- .../Attributes/OuterLoopAttribute.cs | 20 -- .../Attributes/PlatformSpecificAttribute.cs | 19 -- .../Attributes/SkipOnCoreClrAttribute.cs | 21 -- .../Attributes/SkipOnMonoAttribute.cs | 18 - .../SkipOnTargetFrameworkAttribute.cs | 19 -- .../Attributes/TestCategoryAttribute.cs | 19 -- .../ConditionalDiscovererException.cs | 13 - .../DesktopTraceListener.cs | 32 -- .../DiscovererHelpers.cs | 26 -- .../Discoverers/ActiveIssueDiscoverer.cs | 63 ---- .../Discoverers/ConditionalClassDiscoverer.cs | 70 ---- .../Discoverers/ConditionalFactDiscoverer.cs | 27 -- .../Discoverers/ConditionalTestDiscoverer.cs | 180 ---------- .../ConditionalTheoryDiscoverer.cs | 59 ---- .../Discoverers/OuterLoopTestsDiscoverer.cs | 27 -- .../Discoverers/PlatformSpecificDiscoverer.cs | 39 --- .../Discoverers/SkipOnCoreClrDiscoverer.cs | 103 ------ .../Discoverers/SkipOnMonoDiscoverer.cs | 39 --- .../SkipOnTargetFrameworkDiscoverer.cs | 37 -- .../Discoverers/TestCategoryDiscoverer.cs | 31 -- .../Extensions/AssertExtensions.cs | 321 ------------------ .../Extensions/PlatformDetection.cs | 16 - .../Extensions/TheoryExtensions.cs | 38 --- .../Microsoft.DotNet.XUnitExtensions.csproj | 56 --- .../RuntimeStressTestModes.cs | 39 --- .../SkippedFactTestCase.cs | 39 --- .../SkippedTestCase.cs | 48 --- .../SkippedTestMessageBus.cs | 50 --- .../SkippedTheoryTestCase.cs | 39 --- .../TargetFrameworkMonikers.cs | 17 - .../TestPlatforms.cs | 20 -- .../XunitConstants.cs | 28 -- 39 files changed, 1684 deletions(-) delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ActiveIssueAttribute.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ConditionalClassAttribute.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ConditionalFactAttribute.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ConditionalTheoryAttribute.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/OuterLoopAttribute.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/PlatformSpecificAttribute.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/SkipOnCoreClrAttribute.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/SkipOnMonoAttribute.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/SkipOnTargetFrameworkAttribute.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/TestCategoryAttribute.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/ConditionalDiscovererException.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/DesktopTraceListener.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/DiscovererHelpers.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ActiveIssueDiscoverer.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalClassDiscoverer.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalFactDiscoverer.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalTestDiscoverer.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalTheoryDiscoverer.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/OuterLoopTestsDiscoverer.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/PlatformSpecificDiscoverer.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/SkipOnCoreClrDiscoverer.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/SkipOnMonoDiscoverer.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/SkipOnTargetFrameworkDiscoverer.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/TestCategoryDiscoverer.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Extensions/AssertExtensions.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Extensions/PlatformDetection.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Extensions/TheoryExtensions.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Microsoft.DotNet.XUnitExtensions.csproj delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/RuntimeStressTestModes.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedFactTestCase.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedTestCase.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedTestMessageBus.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedTheoryTestCase.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/TargetFrameworkMonikers.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/TestPlatforms.cs delete mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/XunitConstants.cs diff --git a/build.proj b/build.proj index 32087f07de..9714ff2b1c 100644 --- a/build.proj +++ b/build.proj @@ -53,7 +53,6 @@ - @@ -64,7 +63,6 @@ - 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 ad19a2dc4c..7b72749e61 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 @@ -103,9 +103,6 @@ TDS - 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 257c3b4fca..c1ce4f8d00 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 @@ -310,9 +310,6 @@ Utf8String - diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ActiveIssueAttribute.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ActiveIssueAttribute.cs deleted file mode 100644 index 97c9e4b521..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ActiveIssueAttribute.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - /// - /// Apply this attribute to your test method to specify an active issue. - /// - [TraitDiscoverer("Microsoft.DotNet.XUnitExtensions.ActiveIssueDiscoverer", "Microsoft.DotNet.XUnitExtensions")] - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] - public class ActiveIssueAttribute : Attribute, ITraitAttribute - { - public ActiveIssueAttribute(int issueNumber, TestPlatforms platforms) { } - public ActiveIssueAttribute(string issue, TestPlatforms platforms) { } - public ActiveIssueAttribute(int issueNumber, TargetFrameworkMonikers framework) { } - public ActiveIssueAttribute(string issue, TargetFrameworkMonikers framework) { } - public ActiveIssueAttribute(int issueNumber, TestPlatforms platforms = TestPlatforms.Any, TargetFrameworkMonikers framework = (TargetFrameworkMonikers)0) { } - public ActiveIssueAttribute(string issue, TestPlatforms platforms = TestPlatforms.Any, TargetFrameworkMonikers framework = (TargetFrameworkMonikers)0) { } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ConditionalClassAttribute.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ConditionalClassAttribute.cs deleted file mode 100644 index 6ca0fc3bf0..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ConditionalClassAttribute.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - [TraitDiscoverer("Microsoft.DotNet.XUnitExtensions.ConditionalClassDiscoverer", "Microsoft.DotNet.XUnitExtensions")] - [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] - public sealed class ConditionalClassAttribute : Attribute, ITraitAttribute - { - public Type CalleeType { get; private set; } - public string[] ConditionMemberNames { get; private set; } - - public ConditionalClassAttribute(Type calleeType, params string[] conditionMemberNames) - { - CalleeType = calleeType; - ConditionMemberNames = conditionMemberNames; - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ConditionalFactAttribute.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ConditionalFactAttribute.cs deleted file mode 100644 index 54996c0449..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ConditionalFactAttribute.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - [XunitTestCaseDiscoverer("Microsoft.DotNet.XUnitExtensions.ConditionalFactDiscoverer", "Microsoft.DotNet.XUnitExtensions")] - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - public sealed class ConditionalFactAttribute : FactAttribute - { - public Type CalleeType { get; private set; } - public string[] ConditionMemberNames { get; private set; } - - public ConditionalFactAttribute(Type calleeType, params string[] conditionMemberNames) - { - CalleeType = calleeType; - ConditionMemberNames = conditionMemberNames; - } - - public ConditionalFactAttribute(params string[] conditionMemberNames) - { - ConditionMemberNames = conditionMemberNames; - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ConditionalTheoryAttribute.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ConditionalTheoryAttribute.cs deleted file mode 100644 index f924102cab..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/ConditionalTheoryAttribute.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - [XunitTestCaseDiscoverer("Microsoft.DotNet.XUnitExtensions.ConditionalTheoryDiscoverer", "Microsoft.DotNet.XUnitExtensions")] - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - public sealed class ConditionalTheoryAttribute : TheoryAttribute - { - public Type CalleeType { get; private set; } - public string[] ConditionMemberNames { get; private set; } - - public ConditionalTheoryAttribute(Type calleeType, params string[] conditionMemberNames) - { - CalleeType = calleeType; - ConditionMemberNames = conditionMemberNames; - } - - public ConditionalTheoryAttribute(params string[] conditionMemberNames) - { - ConditionMemberNames = conditionMemberNames; - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/OuterLoopAttribute.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/OuterLoopAttribute.cs deleted file mode 100644 index 6194eadbd6..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/OuterLoopAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - /// - /// Apply this attribute to your test method to specify a outer-loop category. - /// - [TraitDiscoverer("Microsoft.DotNet.XUnitExtensions.OuterLoopTestsDiscoverer", "Microsoft.DotNet.XUnitExtensions")] - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] - public class OuterLoopAttribute : Attribute, ITraitAttribute - { - public OuterLoopAttribute() { } - public OuterLoopAttribute(string reason) { } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/PlatformSpecificAttribute.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/PlatformSpecificAttribute.cs deleted file mode 100644 index 0f4d6bd025..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/PlatformSpecificAttribute.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - /// - /// Apply this attribute to your test method to specify this is a platform specific test. - /// - [TraitDiscoverer("Microsoft.DotNet.XUnitExtensions.PlatformSpecificDiscoverer", "Microsoft.DotNet.XUnitExtensions")] - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)] - public class PlatformSpecificAttribute : Attribute, ITraitAttribute - { - public PlatformSpecificAttribute(TestPlatforms platforms) { } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/SkipOnCoreClrAttribute.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/SkipOnCoreClrAttribute.cs deleted file mode 100644 index abf1fda557..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/SkipOnCoreClrAttribute.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - [TraitDiscoverer("Microsoft.DotNet.XUnitExtensions.SkipOnCoreClrDiscoverer", "Microsoft.DotNet.XUnitExtensions")] - [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] - public class SkipOnCoreClrAttribute : Attribute, ITraitAttribute - { - internal SkipOnCoreClrAttribute() { } - - public SkipOnCoreClrAttribute(string reason, TestPlatforms testPlatforms) { } - public SkipOnCoreClrAttribute(string reason, RuntimeStressTestModes testMode) { } - public SkipOnCoreClrAttribute(string reason, TestPlatforms testPlatforms, RuntimeStressTestModes testMode) { } - public SkipOnCoreClrAttribute(string reason) { } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/SkipOnMonoAttribute.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/SkipOnMonoAttribute.cs deleted file mode 100644 index b535ebf1c3..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/SkipOnMonoAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions.Attributes -{ - [TraitDiscoverer("Microsoft.DotNet.XUnitExtensions.SkipOnMonoDiscoverer", "Microsoft.DotNet.XUnitExtensions")] - [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] - public class SkipOnMonoAttribute : Attribute, ITraitAttribute - { - internal SkipOnMonoAttribute() { } - public SkipOnMonoAttribute(string reason, TestPlatforms testPlatforms = TestPlatforms.Any) { } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/SkipOnTargetFrameworkAttribute.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/SkipOnTargetFrameworkAttribute.cs deleted file mode 100644 index 6ed78b5e0e..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/SkipOnTargetFrameworkAttribute.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - /// - /// Apply this attribute to your test method to specify this is a platform specific test. - /// - [TraitDiscoverer("Microsoft.DotNet.XUnitExtensions.SkipOnTargetFrameworkDiscoverer", "Microsoft.DotNet.XUnitExtensions")] - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] - public class SkipOnTargetFrameworkAttribute : Attribute, ITraitAttribute - { - public SkipOnTargetFrameworkAttribute(TargetFrameworkMonikers platform, string reason = null) { } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/TestCategoryAttribute.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/TestCategoryAttribute.cs deleted file mode 100644 index 013931dc00..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Attributes/TestCategoryAttribute.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - /// - /// Apply this attribute to your test method to specify the test category. - /// - [TraitDiscoverer("Microsoft.DotNet.XUnitExtensions.TestCategoryDiscoverer", "Microsoft.DotNet.XUnitExtensions")] - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] - public class TestCategoryAttribute : Attribute, ITraitAttribute - { - public TestCategoryAttribute(string category) { } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/ConditionalDiscovererException.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/ConditionalDiscovererException.cs deleted file mode 100644 index 4a7e80b6f7..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/ConditionalDiscovererException.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.DotNet.XUnitExtensions -{ - internal class ConditionalDiscovererException : Exception - { - public ConditionalDiscovererException(string message) : base(message) { } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/DesktopTraceListener.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/DesktopTraceListener.cs deleted file mode 100644 index 7adc2fbb53..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/DesktopTraceListener.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Diagnostics; - -namespace Microsoft.DotNet.XUnitExtensions -{ - /// - /// Trace Listener for corefx Desktop test execution to avoid showing assert pop-ups and making the test fail when an Assert fails. - /// - public class DesktopTestTraceListener : DefaultTraceListener - { - /// - /// Override of to handle Assert failures with custom behavior. - /// When an Assert failure happens during test execution we will rather throw a DebugAssertException so that the test fails and we have a full StackTrace. - /// - public override void Fail(string message, string detailMessage) - { - throw new DebugAssertException(message, detailMessage); - } - - private sealed class DebugAssertException : Exception - { - internal DebugAssertException(string message, string detailMessage) : - base(message + Environment.NewLine + detailMessage) - { - } - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/DiscovererHelpers.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/DiscovererHelpers.cs deleted file mode 100644 index 5dab843fab..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/DiscovererHelpers.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; -using Xunit; - -namespace Microsoft.DotNet.XUnitExtensions -{ - internal static class DiscovererHelpers - { - internal static bool TestPlatformApplies(TestPlatforms platforms) => -#if NETCOREAPP - (platforms.HasFlag(TestPlatforms.FreeBSD) && RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD"))) || - (platforms.HasFlag(TestPlatforms.Linux) && RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) || - (platforms.HasFlag(TestPlatforms.NetBSD) && RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD"))) || - (platforms.HasFlag(TestPlatforms.OSX) && RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) || - (platforms.HasFlag(TestPlatforms.Windows) && RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); -# else - (platforms.HasFlag(TestPlatforms.Windows) && (int)Environment.OSVersion.Platform == 2) || - (platforms.HasFlag(TestPlatforms.Linux) && (int)Environment.OSVersion.Platform == 4) || - (platforms.HasFlag(TestPlatforms.OSX) && (int)Environment.OSVersion.Platform == 6); -#endif - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ActiveIssueDiscoverer.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ActiveIssueDiscoverer.cs deleted file mode 100644 index 0e45c581bd..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ActiveIssueDiscoverer.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using Xunit; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - /// - /// This class discovers all of the tests and test classes that have - /// applied the ActiveIssue attribute - /// - public class ActiveIssueDiscoverer : ITraitDiscoverer - { - /// - /// Gets the trait values from the Category attribute. - /// - /// The trait attribute containing the trait values. - /// The trait values. - public IEnumerable> GetTraits(IAttributeInfo traitAttribute) - { - IEnumerable ctorArgs = traitAttribute.GetConstructorArguments(); - Debug.Assert(ctorArgs.Count() >= 2); - - string issue = ctorArgs.First().ToString(); - TestPlatforms platforms = TestPlatforms.Any; - TargetFrameworkMonikers frameworks = (TargetFrameworkMonikers)0; - - foreach (object arg in ctorArgs.Skip(1)) // First argument is the issue number. - { - if (arg is TestPlatforms) - { - platforms = (TestPlatforms)arg; - } - else if (arg is TargetFrameworkMonikers) - { - frameworks = (TargetFrameworkMonikers)arg; - } - } - - if (DiscovererHelpers.TestPlatformApplies(platforms)) - { - if (frameworks.HasFlag(TargetFrameworkMonikers.Netcoreapp)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetcoreappTest); - if (frameworks.HasFlag(TargetFrameworkMonikers.NetFramework)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetfxTest); - if (frameworks.HasFlag(TargetFrameworkMonikers.Uap)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonUapTest); - if (frameworks.HasFlag(TargetFrameworkMonikers.Mono)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonMonoTest); - if (frameworks == (TargetFrameworkMonikers)0) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.Failing); - - yield return new KeyValuePair(XunitConstants.ActiveIssue, issue); - } - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalClassDiscoverer.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalClassDiscoverer.cs deleted file mode 100644 index 7703101313..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalClassDiscoverer.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Reflection; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - /// - /// This class discovers all of the tests and test classes that have - /// applied the ConditionalClass attribute - /// - public class ConditionalClassDiscoverer : ITraitDiscoverer - { - /// - /// Gets the trait values from the Category attribute. - /// - /// The trait attribute containing the trait values. - /// The trait values. - public IEnumerable> GetTraits(IAttributeInfo traitAttribute) - { - // If evaluated to false, skip the test class entirely. - if (!EvaluateParameterHelper(traitAttribute)) - { - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.Failing); - } - } - - internal static bool EvaluateParameterHelper(IAttributeInfo traitAttribute) - { - // Parse the traitAttribute. We make sure it contains two parts: - // 1. Type 2. nameof(conditionMemberName) - object[] conditionArguments = traitAttribute.GetConstructorArguments().ToArray(); - Debug.Assert(conditionArguments.Count() == 2); - - Type calleeType = null; - string[] conditionMemberNames = null; - - if (ConditionalTestDiscoverer.CheckInputToSkipExecution(conditionArguments, ref calleeType, ref conditionMemberNames)) - { - return true; - } - - foreach (string entry in conditionMemberNames) - { - // Null condition member names are silently tolerated. - if (string.IsNullOrWhiteSpace(entry)) - continue; - - MethodInfo conditionMethodInfo = ConditionalTestDiscoverer.LookupConditionalMethod(calleeType, entry); - if (conditionMethodInfo == null) - { - throw new InvalidOperationException($"Unable to get MethodInfo, please check input for {entry}."); - } - - // If one of the conditions is false, then return the category failing trait. - if (!(bool)conditionMethodInfo.Invoke(null, null)) - return false; - } - - return true; - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalFactDiscoverer.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalFactDiscoverer.cs deleted file mode 100644 index 3b9e368ae9..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalFactDiscoverer.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Linq; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - public class ConditionalFactDiscoverer : FactDiscoverer - { - public ConditionalFactDiscoverer(IMessageSink diagnosticMessageSink) : base(diagnosticMessageSink) { } - - protected override IXunitTestCase CreateTestCase(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute) - { - if (ConditionalTestDiscoverer.TryEvaluateSkipConditions(discoveryOptions, DiagnosticMessageSink, testMethod, factAttribute.GetConstructorArguments().ToArray(), out string skipReason, out ExecutionErrorTestCase errorTestCase)) - { - return skipReason != null - ? (IXunitTestCase)new SkippedTestCase(skipReason, DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod) - : new SkippedFactTestCase(DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod); // Test case skippable at runtime. - } - - return errorTestCase; - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalTestDiscoverer.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalTestDiscoverer.cs deleted file mode 100644 index eac5543402..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalTestDiscoverer.cs +++ /dev/null @@ -1,180 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - // Internal helper class for code common to conditional test discovery through - // [ConditionalFact] and [ConditionalTheory] - internal static class ConditionalTestDiscoverer - { - // This helper method evaluates the given condition member names for a given set of test cases. - // If any condition member evaluates to 'false', the test cases are marked to be skipped. - // The skip reason is the collection of all the condition members that evaluated to 'false'. - internal static string EvaluateSkipConditions(ITestMethod testMethod, object[] conditionArguments) - { - Type calleeType = null; - string[] conditionMemberNames = null; - - if (CheckInputToSkipExecution(conditionArguments, ref calleeType, ref conditionMemberNames, testMethod)) - return null; - - MethodInfo testMethodInfo = testMethod.Method.ToRuntimeMethod(); - Type testMethodDeclaringType = testMethodInfo.DeclaringType; - List falseConditions = new List(conditionMemberNames.Count()); - - foreach (string entry in conditionMemberNames) - { - string conditionMemberName = entry; - - // Null condition member names are silently tolerated - if (string.IsNullOrWhiteSpace(conditionMemberName)) - { - continue; - } - - Type declaringType; - - if (calleeType != null) - { - declaringType = calleeType; - } - else - { - declaringType = testMethodDeclaringType; - - string[] symbols = conditionMemberName.Split('.'); - if (symbols.Length == 2) - { - conditionMemberName = symbols[1]; - ITypeInfo type = testMethod.TestClass.Class.Assembly.GetTypes(false).Where(t => t.Name.Contains(symbols[0])).FirstOrDefault(); - if (type != null) - { - declaringType = type.ToRuntimeType(); - } - } - } - - MethodInfo conditionMethodInfo; - if ((conditionMethodInfo = LookupConditionalMethod(declaringType, conditionMemberName)) == null) - { - throw new ConditionalDiscovererException(GetFailedLookupString(conditionMemberName, declaringType)); - } - - // In the case of multiple conditions, collect the results of all - // of them to produce a summary skip reason. - try - { - if (!(bool)conditionMethodInfo.Invoke(null, null)) - { - falseConditions.Add(conditionMemberName); - } - } - catch (Exception exc) - { - falseConditions.Add($"{conditionMemberName} ({exc.GetType().Name})"); - } - } - - // Compose a summary of all conditions that returned false. - if (falseConditions.Count > 0) - { - return string.Format("Condition(s) not met: \"{0}\"", string.Join("\", \"", falseConditions)); - } - - // No conditions returned false (including the absence of any conditions). - return null; - } - - internal static bool TryEvaluateSkipConditions(ITestFrameworkDiscoveryOptions discoveryOptions, IMessageSink diagnosticMessageSink, ITestMethod testMethod, object[] conditionArguments, out string skipReason, out ExecutionErrorTestCase errorTestCase) - { - skipReason = null; - errorTestCase = null; - try - { - skipReason = EvaluateSkipConditions(testMethod, conditionArguments); - return true; - } - catch (ConditionalDiscovererException e) - { - errorTestCase = new ExecutionErrorTestCase( - diagnosticMessageSink, - discoveryOptions.MethodDisplayOrDefault(), - discoveryOptions.MethodDisplayOptionsOrDefault(), - testMethod, - e.Message); - return false; - } - } - - internal static string GetFailedLookupString(string name, Type type) - { - return - $"An appropriate member '{name}' could not be found. " + - $"The conditional method needs to be a static method or property on the type {type} or any ancestor, " + - "of any visibility, accepting zero arguments, and having a return type of Boolean."; - } - - internal static MethodInfo LookupConditionalMethod(Type t, string name) - { - if (t == null || name == null) - return null; - - TypeInfo ti = t.GetTypeInfo(); - - MethodInfo mi = ti.GetDeclaredMethod(name); - if (mi != null && mi.IsStatic && mi.GetParameters().Length == 0 && mi.ReturnType == typeof(bool)) - return mi; - - PropertyInfo pi = ti.GetDeclaredProperty(name); - if (pi != null && pi.PropertyType == typeof(bool) && pi.GetMethod != null && pi.GetMethod.IsStatic && pi.GetMethod.GetParameters().Length == 0) - return pi.GetMethod; - - return LookupConditionalMethod(ti.BaseType, name); - } - - internal static bool CheckInputToSkipExecution(object[] conditionArguments, ref Type calleeType, ref string[] conditionMemberNames, ITestMethod testMethod = null) - { - // A null or empty list of conditionArguments is treated as "no conditions". - // and the test cases will be executed. - // Example: [ConditionalClass()] - if (conditionArguments == null || conditionArguments.Length == 0) - return true; - - calleeType = conditionArguments[0] as Type; - if (calleeType != null) - { - if (conditionArguments.Length < 2) - { - // [ConditionalFact(typeof(x))] no provided methods. - return true; - } - - // [ConditionalFact(typeof(x), "MethodName")] - conditionMemberNames = conditionArguments[1] as string[]; - } - else - { - // For [ConditionalClass], unable to get the Type info. All test cases will be executed. - if (testMethod == null) - return true; - - // [ConditionalFact("MethodName")] - conditionMemberNames = conditionArguments[0] as string[]; - } - - // [ConditionalFact((string[]) null)] - if (conditionMemberNames == null || conditionMemberNames.Count() == 0) - return true; - - return false; - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalTheoryDiscoverer.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalTheoryDiscoverer.cs deleted file mode 100644 index 4bafc37a56..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/ConditionalTheoryDiscoverer.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Linq; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - public class ConditionalTheoryDiscoverer : TheoryDiscoverer - { - private readonly Dictionary _conditionCache; - - public ConditionalTheoryDiscoverer(IMessageSink diagnosticMessageSink) : base(diagnosticMessageSink) - { - _conditionCache = new Dictionary(); - } - - protected override IEnumerable CreateTestCasesForTheory(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo theoryAttribute) - { - if (ConditionalTestDiscoverer.TryEvaluateSkipConditions(discoveryOptions, DiagnosticMessageSink, testMethod, theoryAttribute.GetConstructorArguments().ToArray(), out string skipReason, out ExecutionErrorTestCase errorTestCase)) - { - return skipReason != null - ? new[] { new SkippedTestCase(skipReason, DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod) } - : new IXunitTestCase[] { new SkippedTheoryTestCase(DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod) }; // Theory skippable at runtime. - } - - return new IXunitTestCase[] { errorTestCase }; - } - - protected override IEnumerable CreateTestCasesForDataRow(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo theoryAttribute, object[] dataRow) - { - IMethodInfo methodInfo = testMethod.Method; - List skippedTestCase = new List(); - - if (!_conditionCache.TryGetValue(methodInfo, out string skipReason)) - { - if (!ConditionalTestDiscoverer.TryEvaluateSkipConditions(discoveryOptions, DiagnosticMessageSink, testMethod, theoryAttribute.GetConstructorArguments().ToArray(), out skipReason, out ExecutionErrorTestCase errorTestCase)) - { - return new IXunitTestCase[] { errorTestCase }; - } - - _conditionCache.Add(methodInfo, skipReason); - - if (skipReason != null) - { - // If this is the first time we evalute the condition we return a SkippedTestCase to avoid printing a skip for every inline-data. - skippedTestCase.Add(new SkippedTestCase(skipReason, DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod)); - } - } - - return skipReason != null ? - (IEnumerable)skippedTestCase - : new[] { new SkippedFactTestCase(DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod, dataRow) }; // Test case skippable at runtime. - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/OuterLoopTestsDiscoverer.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/OuterLoopTestsDiscoverer.cs deleted file mode 100644 index df6e168fd5..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/OuterLoopTestsDiscoverer.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - /// - /// This class discovers all of the tests and test classes that have - /// applied the OuterLoop attribute - /// - public class OuterLoopTestsDiscoverer : ITraitDiscoverer - { - /// - /// Gets the trait values from the Category attribute. - /// - /// The trait attribute containing the trait values. - /// The trait values. - public IEnumerable> GetTraits(IAttributeInfo traitAttribute) - { - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.OuterLoop); - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/PlatformSpecificDiscoverer.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/PlatformSpecificDiscoverer.cs deleted file mode 100644 index 1e7b5fe210..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/PlatformSpecificDiscoverer.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Linq; -using Xunit; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - /// - /// This class discovers all of the tests and test classes that have - /// applied the PlatformSpecific attribute - /// - public class PlatformSpecificDiscoverer : ITraitDiscoverer - { - /// - /// Gets the trait values from the Category attribute. - /// - /// The trait attribute containing the trait values. - /// The trait values. - public IEnumerable> GetTraits(IAttributeInfo traitAttribute) - { - TestPlatforms platforms = (TestPlatforms)traitAttribute.GetConstructorArguments().First(); - if (!platforms.HasFlag(TestPlatforms.Windows)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonWindowsTest); - if (!platforms.HasFlag(TestPlatforms.Linux)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonLinuxTest); - if (!platforms.HasFlag(TestPlatforms.OSX)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonOSXTest); - if (!platforms.HasFlag(TestPlatforms.FreeBSD)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonFreeBSDTest); - if (!platforms.HasFlag(TestPlatforms.NetBSD)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetBSDTest); - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/SkipOnCoreClrDiscoverer.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/SkipOnCoreClrDiscoverer.cs deleted file mode 100644 index d3bc7529bb..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/SkipOnCoreClrDiscoverer.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Xunit; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - public class SkipOnCoreClrDiscoverer : ITraitDiscoverer - { - public IEnumerable> GetTraits(IAttributeInfo traitAttribute) - { - if (!SkipOnMonoDiscoverer.IsMonoRuntime) - { - TestPlatforms testPlatforms = TestPlatforms.Any; - RuntimeStressTestModes stressMode = RuntimeStressTestModes.Any; - foreach (object arg in traitAttribute.GetConstructorArguments().Skip(1)) // We skip the first one as it is the reason - { - if (arg is TestPlatforms tp) - { - testPlatforms = tp; - } - else if (arg is RuntimeStressTestModes rstm) - { - stressMode = rstm; - } - } - - if (DiscovererHelpers.TestPlatformApplies(testPlatforms) && StressModeApplies(stressMode)) - { - if (IsCheckedRuntime() || (IsRuntimeStressTesting && !stressMode.HasFlag(RuntimeStressTestModes.CheckedRuntime))) - { - return new[] { new KeyValuePair(XunitConstants.Category, XunitConstants.Failing) }; - } - } - } - - return Array.Empty>(); - } - - // Order here matters as some env variables may appear in multiple modes - private static bool StressModeApplies(RuntimeStressTestModes stressMode) => - stressMode == RuntimeStressTestModes.Any || - (stressMode.HasFlag(RuntimeStressTestModes.GCStress3) && IsGCStress3) || - (stressMode.HasFlag(RuntimeStressTestModes.GCStressC) && IsGCStressC) || - (stressMode.HasFlag(RuntimeStressTestModes.ZapDisable) && IsZapDisable) || - (stressMode.HasFlag(RuntimeStressTestModes.TailcallStress) && IsTailCallStress) || - (stressMode.HasFlag(RuntimeStressTestModes.JitStressRegs) && IsJitStressRegs) || - (stressMode.HasFlag(RuntimeStressTestModes.JitStress) && IsJitStress) || - (stressMode.HasFlag(RuntimeStressTestModes.JitMinOpts) && IsJitMinOpts) || - stressMode == RuntimeStressTestModes.CheckedRuntime; // if checked runtime is the only flag, all stress modes apply. - - // Order here matters as some env variables may appear in multiple modes - private static bool IsRuntimeStressTesting => - IsGCStress3 || - IsGCStressC || - IsZapDisable || - IsTailCallStress || - IsJitStressRegs || - IsJitStress || - IsJitMinOpts; - - private static string GetEnvironmentVariableValue(string name) => Environment.GetEnvironmentVariable(name) ?? "0"; - - private static bool IsJitStress => !string.Equals(GetEnvironmentVariableValue("COMPlus_JitStress"), "0", StringComparison.InvariantCulture); - - private static bool IsJitStressRegs => !string.Equals(GetEnvironmentVariableValue("COMPlus_JitStressRegs"), "0", StringComparison.InvariantCulture); - - private static bool IsJitMinOpts => string.Equals(GetEnvironmentVariableValue("COMPlus_JITMinOpts"), "1", StringComparison.InvariantCulture); - - private static bool IsTailCallStress => string.Equals(GetEnvironmentVariableValue("COMPlus_TailcallStress"), "1", StringComparison.InvariantCulture); - - private static bool IsZapDisable => string.Equals(GetEnvironmentVariableValue("COMPlus_ZapDisable"), "1", StringComparison.InvariantCulture); - - private static bool IsGCStress3 => CompareGCStressModeAsLower(GetEnvironmentVariableValue("COMPlus_GCStress"), "0x3", "3"); - - private static bool IsGCStressC => CompareGCStressModeAsLower(GetEnvironmentVariableValue("COMPlus_GCStress"), "0xC", "C"); - - private static bool IsCheckedRuntime() - { - Assembly assembly = typeof(string).Assembly; - AssemblyConfigurationAttribute assemblyConfigurationAttribute = assembly.GetCustomAttribute(); - - return assemblyConfigurationAttribute != null && - string.Equals(assemblyConfigurationAttribute.Configuration, "Checked", StringComparison.InvariantCulture); - } - - private static bool CompareGCStressModeAsLower(string value, string first, string second) - { - value = value.ToLowerInvariant(); - return string.Equals(value, first.ToLowerInvariant(), StringComparison.InvariantCulture) || - string.Equals(value, second.ToLowerInvariant(), StringComparison.InvariantCulture) || - string.Equals(value, "0xf", StringComparison.InvariantCulture) || - string.Equals(value, "f", StringComparison.InvariantCulture); - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/SkipOnMonoDiscoverer.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/SkipOnMonoDiscoverer.cs deleted file mode 100644 index 45e99abce5..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/SkipOnMonoDiscoverer.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Xunit; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - public class SkipOnMonoDiscoverer : ITraitDiscoverer - { - public IEnumerable> GetTraits(IAttributeInfo traitAttribute) - { - if (IsMonoRuntime) - { - TestPlatforms testPlatforms = TestPlatforms.Any; - - // Last argument is either the TestPlatform or the test platform to skip the test on. - if (traitAttribute.GetConstructorArguments().LastOrDefault() is TestPlatforms tp) - { - testPlatforms = tp; - } - - if (DiscovererHelpers.TestPlatformApplies(testPlatforms)) - { - return new[] { new KeyValuePair(XunitConstants.Category, XunitConstants.Failing) }; - } - } - - return Array.Empty>(); - } - - public static bool IsMonoRuntime => Type.GetType("Mono.RuntimeStructs") != null; - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/SkipOnTargetFrameworkDiscoverer.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/SkipOnTargetFrameworkDiscoverer.cs deleted file mode 100644 index 7e031f2650..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/SkipOnTargetFrameworkDiscoverer.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Linq; -using Xunit; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - /// - /// This class discovers all of the tests and test classes that have - /// applied the TestOnTargetFrameworkDiscoverer attribute - /// - public class SkipOnTargetFrameworkDiscoverer : ITraitDiscoverer - { - /// - /// Gets the trait values from the Category attribute. - /// - /// The trait attribute containing the trait values. - /// The trait values. - public IEnumerable> GetTraits(IAttributeInfo traitAttribute) - { - TargetFrameworkMonikers frameworks = (TargetFrameworkMonikers)traitAttribute.GetConstructorArguments().First(); - if (frameworks.HasFlag(TargetFrameworkMonikers.Netcoreapp)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetcoreappTest); - if (frameworks.HasFlag(TargetFrameworkMonikers.NetFramework)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonNetfxTest); - if (frameworks.HasFlag(TargetFrameworkMonikers.Uap)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonUapTest); - if (frameworks.HasFlag(TargetFrameworkMonikers.Mono)) - yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonMonoTest); - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/TestCategoryDiscoverer.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/TestCategoryDiscoverer.cs deleted file mode 100644 index 4f30e9c42d..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Discoverers/TestCategoryDiscoverer.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Linq; -using Xunit.Abstractions; -using Xunit.Sdk; - -/// -/// This is a replacement for the MSTest [TestCategoryAttribute] on xunit -/// xunit does not have the concept of Category for tests and instead, the have [TraitAttribute(string key, string value)] -/// If we replace the MSTest [TestCategoryAttribute] for the [TestCategory("BVT")], we will surely fall at some time in cases -/// where people will typo on the "Category" key part of the Trait. -/// On order to achieve the same behaviour as on MSTest, a custom [TestCategory] was created -/// to mimic the MSTest one and avoid replace it on every existent test. -/// The tests can be filtered by xunit runners by usage of "-trait" on the command line with the expression like -/// -trait "Category=BVT" for example that will only run the tests with [TestCategory("BVT")] on it. -/// - -namespace Microsoft.DotNet.XUnitExtensions -{ - public class TestCategoryDiscoverer : ITraitDiscoverer - { - public IEnumerable> GetTraits(IAttributeInfo traitAttribute) - { - var ctorArgs = traitAttribute.GetConstructorArguments().ToList(); - yield return new KeyValuePair("Category", ctorArgs[0].ToString()); - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Extensions/AssertExtensions.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Extensions/AssertExtensions.cs deleted file mode 100644 index ed0c0af5cf..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Extensions/AssertExtensions.cs +++ /dev/null @@ -1,321 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Linq; -using System.Runtime.InteropServices; -using System.Threading.Tasks; -using Xunit; -using Xunit.Sdk; - -namespace System -{ - public static class AssertExtensions - { - private static bool IsFullFramework => RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework"); - - public static void Throws(Action action, string message) - where T : Exception - { - Assert.Equal(Assert.Throws(action).Message, message); - } - - public static void Throws(string netCoreParamName, string netFxParamName, Action action) - where T : ArgumentException - { - T exception = Assert.Throws(action); - - if (netFxParamName == null && IsFullFramework) - { - // Param name varies between NETFX versions -- skip checking it - return; - } - - string expectedParamName = - IsFullFramework ? - netFxParamName : netCoreParamName; - - if (!RuntimeInformation.FrameworkDescription.StartsWith(".NET Native")) - Assert.Equal(expectedParamName, exception.ParamName); - } - - public static void Throws(string netCoreParamName, string netFxParamName, Func testCode) - where T : ArgumentException - { - T exception = Assert.Throws(testCode); - - if (netFxParamName == null && IsFullFramework) - { - // Param name varies between NETFX versions -- skip checking it - return; - } - - string expectedParamName = - IsFullFramework ? - netFxParamName : netCoreParamName; - - if (!RuntimeInformation.FrameworkDescription.StartsWith(".NET Native")) - Assert.Equal(expectedParamName, exception.ParamName); - } - - public static T Throws(string paramName, Action action) - where T : ArgumentException - { - T exception = Assert.Throws(action); - - if (!RuntimeInformation.FrameworkDescription.StartsWith(".NET Native")) - Assert.Equal(paramName, exception.ParamName); - - return exception; - } - - public static T Throws(Action action) - where T : Exception - { - T exception = Assert.Throws(action); - - return exception; - } - - public static T Throws(string paramName, Func testCode) - where T : ArgumentException - { - T exception = Assert.Throws(testCode); - - if (!RuntimeInformation.FrameworkDescription.StartsWith(".NET Native")) - Assert.Equal(paramName, exception.ParamName); - - return exception; - } - - public static async Task ThrowsAsync(string paramName, Func testCode) - where T : ArgumentException - { - T exception = await Assert.ThrowsAsync(testCode); - - if (!RuntimeInformation.FrameworkDescription.StartsWith(".NET Native")) - Assert.Equal(paramName, exception.ParamName); - - return exception; - } - - public static void Throws(string paramName, Action action) - where TNetCoreExceptionType : ArgumentException - where TNetFxExceptionType : ArgumentException - { - Throws(paramName, paramName, action); - } - - public static Exception Throws(Action action) - where TNetCoreExceptionType : Exception - where TNetFxExceptionType : Exception - { - return Throws(typeof(TNetCoreExceptionType), typeof(TNetFxExceptionType), action); - } - - public static Exception Throws(Type netCoreExceptionType, Type netFxExceptionType, Action action) - { - if (IsFullFramework) - { - return Assert.Throws(netFxExceptionType, action); - } - else - { - return Assert.Throws(netCoreExceptionType, action); - } - } - - public static void Throws(string netCoreParamName, string netFxParamName, Action action) - where TNetCoreExceptionType : ArgumentException - where TNetFxExceptionType : ArgumentException - { - if (IsFullFramework) - { - Throws(netFxParamName, action); - } - else - { - Throws(netCoreParamName, action); - } - } - - public static void ThrowsAny(Type firstExceptionType, Type secondExceptionType, Action action) - { - ThrowsAnyInternal(action, firstExceptionType, secondExceptionType); - } - - private static void ThrowsAnyInternal(Action action, params Type[] exceptionTypes) - { - try - { - action(); - } - catch (Exception e) - { - Type exceptionType = e.GetType(); - if (exceptionTypes.Any(t => t.Equals(exceptionType))) - return; - - throw new XunitException($"Expected one of: ({string.Join(", ", exceptionTypes)}) -> Actual: ({e.GetType()})"); - } - - throw new XunitException($"Expected one of: ({string.Join(", ", exceptionTypes)}) -> Actual: No exception thrown"); - } - - public static void ThrowsAny(Action action) - where TFirstExceptionType : Exception - where TSecondExceptionType : Exception - { - ThrowsAnyInternal(action, typeof(TFirstExceptionType), typeof(TSecondExceptionType)); - } - - public static void ThrowsAny(Action action) - where TFirstExceptionType : Exception - where TSecondExceptionType : Exception - where TThirdExceptionType : Exception - { - ThrowsAnyInternal(action, typeof(TFirstExceptionType), typeof(TSecondExceptionType), typeof(TThirdExceptionType)); - } - - public static void ThrowsIf(bool condition, Action action) - where T : Exception - { - if (condition) - { - Assert.Throws(action); - } - else - { - action(); - } - } - - private static string AddOptionalUserMessage(string message, string userMessage) - { - if (userMessage == null) - return message; - else - return $"{message} {userMessage}"; - } - - /// - /// Tests whether the specified string contains the specified substring - /// and throws an exception if the substring does not occur within the - /// test string or if either string or substring is null. - /// - /// - /// The string that is expected to contain . - /// - /// - /// The string expected to occur within . - /// - public static void Contains(string value, string substring) - { - Assert.NotNull(value); - Assert.NotNull(substring); - Assert.Contains(substring, value, StringComparison.Ordinal); - } - - /// - /// Validate that a given value is greater than another value. - /// - /// The value that should be greater than . - /// The value that should be greater than. - public static void GreaterThan(T actual, T greaterThan, string userMessage = null) where T : IComparable - { - if (actual == null) - throw new XunitException( - greaterThan == null - ? AddOptionalUserMessage($"Expected: to be greater than .", userMessage) - : AddOptionalUserMessage($"Expected: to be greater than {greaterThan}.", userMessage)); - - if (actual.CompareTo(greaterThan) <= 0) - throw new XunitException(AddOptionalUserMessage($"Expected: {actual} to be greater than {greaterThan}", userMessage)); - } - - /// - /// Validate that a given value is less than another value. - /// - /// The value that should be less than . - /// The value that should be less than. - public static void LessThan(T actual, T lessThan, string userMessage = null) where T : IComparable - { - if (actual == null) - { - if (lessThan == null) - { - throw new XunitException(AddOptionalUserMessage($"Expected: to be less than .", userMessage)); - } - else - { - // Null is always less than non-null - return; - } - } - - if (actual.CompareTo(lessThan) >= 0) - throw new XunitException(AddOptionalUserMessage($"Expected: {actual} to be less than {lessThan}", userMessage)); - } - - /// - /// Validate that a given value is less than or equal to another value. - /// - /// The value that should be less than or equal to - /// The value that should be less than or equal to. - public static void LessThanOrEqualTo(T actual, T lessThanOrEqualTo, string userMessage = null) where T : IComparable - { - // null, by definition is always less than or equal to - if (actual == null) - return; - - if (actual.CompareTo(lessThanOrEqualTo) > 0) - throw new XunitException(AddOptionalUserMessage($"Expected: {actual} to be less than or equal to {lessThanOrEqualTo}", userMessage)); - } - - /// - /// Validate that a given value is greater than or equal to another value. - /// - /// The value that should be greater than or equal to - /// The value that should be greater than or equal to. - public static void GreaterThanOrEqualTo(T actual, T greaterThanOrEqualTo, string userMessage = null) where T : IComparable - { - // null, by definition is always less than or equal to - if (actual == null) - { - if (greaterThanOrEqualTo == null) - { - // We're equal - return; - } - else - { - // Null is always less than non-null - throw new XunitException(AddOptionalUserMessage($"Expected: to be greater than or equal to .", userMessage)); - } - } - - if (actual.CompareTo(greaterThanOrEqualTo) < 0) - throw new XunitException(AddOptionalUserMessage($"Expected: {actual} to be greater than or equal to {greaterThanOrEqualTo}", userMessage)); - } - - /// - /// Validates that the actual byte array is equal to the expected byte array. XUnit only displays the first 5 values - /// of each collection if the test fails. This doesn't display at what point or how the equality assertion failed. - /// - /// The byte array that should be equal to. - /// - public static void Equal(byte[] expected, byte[] actual) - { - try - { - Assert.Equal(expected, actual); - } - catch (AssertActualExpectedException) - { - string expectedString = string.Join(", ", expected); - string actualString = string.Join(", ", actual); - throw new AssertActualExpectedException(expectedString, actualString, null); - } - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Extensions/PlatformDetection.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Extensions/PlatformDetection.cs deleted file mode 100644 index 24b9e24b4f..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Extensions/PlatformDetection.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; - -namespace System -{ - public static partial class PlatformDetection - { - public static bool IsArmProcess => RuntimeInformation.ProcessArchitecture == Architecture.Arm; - public static bool IsNotArmProcess => !IsArmProcess; - public static bool IsX86Process => RuntimeInformation.ProcessArchitecture == Architecture.X86; - public static bool IsNotX86Process => !IsX86Process; - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Extensions/TheoryExtensions.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Extensions/TheoryExtensions.cs deleted file mode 100644 index 110af4dedb..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Extensions/TheoryExtensions.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using Xunit; - -namespace Microsoft.DotNet.XUnitExtensions -{ - public static class TheoryExtensions - { - /// - /// Converts an IEnumerable into an Xunit theory compatible enumerable. - /// - public static TheoryData ToTheoryData(this IEnumerable data) - { - // Returning TheoryData rather than IEnumerable directly should - // encourage discover and usage of TheoryData classes for more - // complicated theories. Slightly easier to type as well. - return new TheoryDataAdapter(data.Select(d => new object[] { d })); - } - - private class TheoryDataAdapter : TheoryData, IEnumerable - { - private IEnumerable _data; - - public TheoryDataAdapter(IEnumerable data) - { - _data = data; - } - - public new IEnumerator GetEnumerator() => _data.GetEnumerator(); - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Microsoft.DotNet.XUnitExtensions.csproj b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Microsoft.DotNet.XUnitExtensions.csproj deleted file mode 100644 index a61443eafe..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/Microsoft.DotNet.XUnitExtensions.csproj +++ /dev/null @@ -1,56 +0,0 @@ - - - Microsoft.DotNet.XUnitExtensions - netcoreapp - netfx - false - $(ObjFolder)$(Configuration).$(Platform)\$(AssemblyName) - $(BinFolder)$(Configuration).$(Platform)\$(AssemblyName) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/RuntimeStressTestModes.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/RuntimeStressTestModes.cs deleted file mode 100644 index 356c7a2910..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/RuntimeStressTestModes.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Xunit -{ - [Flags] - public enum RuntimeStressTestModes - { - // Disable on any stress test mode or on checked runtime. - // Can't be ~0 as that would include CheckedRuntime flag, which would break the case - // where you want to disable in all (including release stress test). - Any = 0, - - // JitStress, JitStressRegs, JitMinOpts and TailcallStress enable - // various modes in the JIT that cause us to exercise more code paths, - // and generate different kinds of code - JitStress = 1, // COMPlus_JitStress is set. - JitStressRegs = 1 << 1, // COMPlus_JitStressRegs is set. - JitMinOpts = 1 << 2, // COMPlus_JITMinOpts is set. - TailcallStress = 1 << 3, // COMPlus_TailcallStress is set. - - // ZapDisable says to not use NGEN or ReadyToRun images. - // This means we JIT everything. - ZapDisable = 1 << 4, // COMPlus_ZapDisable is set. - - // GCStress3 forces a GC at various locations, typically transitions - // to/from the VM from managed code. - GCStress3 = 1 << 5, // COMPlus_GCStress includes mode 0x3. - - // GCStressC forces a GC at every JIT-generated code instruction, - // including in NGEN/ReadyToRun code. - GCStressC = 1 << 6, // COMPlus_GCStress includes mode 0xC. - CheckedRuntime = 1 << 7, // Disable only when running on checked runtime. - AnyGCStress = GCStress3 | GCStressC // Disable when any GCStress is exercised. - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedFactTestCase.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedFactTestCase.cs deleted file mode 100644 index 9c05dd4915..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedFactTestCase.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - /// Wraps RunAsync for ConditionalFact. - public class SkippedFactTestCase : XunitTestCase - { - [Obsolete("Called by the de-serializer; should only be called by deriving classes for de-serialization purposes", error: true)] - public SkippedFactTestCase() { } - - public SkippedFactTestCase(IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, TestMethodDisplayOptions defaultMethodDisplayOptions, ITestMethod testMethod, object[] testMethodArguments = null) - : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod, testMethodArguments) { } - - public override async Task RunAsync(IMessageSink diagnosticMessageSink, - IMessageBus messageBus, - object[] constructorArguments, - ExceptionAggregator aggregator, - CancellationTokenSource cancellationTokenSource) - { - SkippedTestMessageBus skipMessageBus = new SkippedTestMessageBus(messageBus); - var result = await base.RunAsync(diagnosticMessageSink, skipMessageBus, constructorArguments, aggregator, cancellationTokenSource); - if (skipMessageBus.SkippedTestCount > 0) - { - result.Failed -= skipMessageBus.SkippedTestCount; - result.Skipped += skipMessageBus.SkippedTestCount; - } - - return result; - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedTestCase.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedTestCase.cs deleted file mode 100644 index 5f1a9079dc..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedTestCase.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - /// Wraps another test case that should be skipped. - internal sealed class SkippedTestCase : XunitTestCase - { - private string _skipReason; - - [Obsolete("Called by the de-serializer; should only be called by deriving classes for de-serialization purposes")] - public SkippedTestCase() : base() - { - } - - public SkippedTestCase( - string skipReason, - IMessageSink diagnosticMessageSink, - TestMethodDisplay defaultMethodDisplay, - TestMethodDisplayOptions defaultMethodDisplayOptions, - ITestMethod testMethod, - object[] testMethodArguments = null) - : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod, testMethodArguments) - { - _skipReason = skipReason; - } - - protected override string GetSkipReason(IAttributeInfo factAttribute) - => _skipReason ?? base.GetSkipReason(factAttribute); - - public override void Deserialize(IXunitSerializationInfo data) - { - base.Deserialize(data); - _skipReason = data.GetValue(nameof(_skipReason)); - } - - public override void Serialize(IXunitSerializationInfo data) - { - base.Serialize(data); - data.AddValue(nameof(_skipReason), _skipReason); - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedTestMessageBus.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedTestMessageBus.cs deleted file mode 100644 index 12f8e28e74..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedTestMessageBus.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Linq; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - public class SkipTestException : Exception - { - public SkipTestException(string reason) - : base(reason) { } - } - - /// Implements message bus to communicate tests skipped via SkipTestException. - public class SkippedTestMessageBus : IMessageBus - { - readonly IMessageBus innerBus; - - public SkippedTestMessageBus(IMessageBus innerBus) - { - this.innerBus = innerBus; - } - - public int SkippedTestCount { get; private set; } - - public void Dispose() { } - - public bool QueueMessage(IMessageSinkMessage message) - { - var testFailed = message as ITestFailed; - - if (testFailed != null) - { - var exceptionType = testFailed.ExceptionTypes.FirstOrDefault(); - if (exceptionType == typeof(SkipTestException).FullName) - { - SkippedTestCount++; - return innerBus.QueueMessage(new TestSkipped(testFailed.Test, testFailed.Messages.FirstOrDefault())); - } - } - - // Nothing we care about, send it on its way - return innerBus.QueueMessage(message); - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedTheoryTestCase.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedTheoryTestCase.cs deleted file mode 100644 index abcf828bd1..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/SkippedTheoryTestCase.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Microsoft.DotNet.XUnitExtensions -{ - /// Wraps RunAsync for ConditionalTheory. - public class SkippedTheoryTestCase : XunitTheoryTestCase - { - [Obsolete("Called by the de-serializer; should only be called by deriving classes for de-serialization purposes", error: true)] - public SkippedTheoryTestCase() { } - - public SkippedTheoryTestCase(IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, TestMethodDisplayOptions defaultMethodDisplayOptions, ITestMethod testMethod) - : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod) { } - - public override async Task RunAsync(IMessageSink diagnosticMessageSink, - IMessageBus messageBus, - object[] constructorArguments, - ExceptionAggregator aggregator, - CancellationTokenSource cancellationTokenSource) - { - SkippedTestMessageBus skipMessageBus = new SkippedTestMessageBus(messageBus); - var result = await base.RunAsync(diagnosticMessageSink, skipMessageBus, constructorArguments, aggregator, cancellationTokenSource); - if (skipMessageBus.SkippedTestCount > 0) - { - result.Failed -= skipMessageBus.SkippedTestCount; - result.Skipped += skipMessageBus.SkippedTestCount; - } - - return result; - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/TargetFrameworkMonikers.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/TargetFrameworkMonikers.cs deleted file mode 100644 index 182768f741..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/TargetFrameworkMonikers.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Xunit -{ - [Flags] - public enum TargetFrameworkMonikers - { - Netcoreapp = 0x1, - NetFramework = 0x2, - Uap = 0x4, - Mono = 0x8 - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/TestPlatforms.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/TestPlatforms.cs deleted file mode 100644 index fe905803be..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/TestPlatforms.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Xunit -{ - [Flags] - public enum TestPlatforms - { - Windows = 1, - Linux = 2, - OSX = 4, - FreeBSD = 8, - NetBSD = 16, - AnyUnix = FreeBSD | Linux | NetBSD | OSX, - Any = ~0 - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/XunitConstants.cs b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/XunitConstants.cs deleted file mode 100644 index 870342bd15..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.DotNet.XUnitExtensions/XunitConstants.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.DotNet.XUnitExtensions -{ - public struct XunitConstants - { - internal const string NonFreeBSDTest = "nonfreebsdtests"; - internal const string NonLinuxTest = "nonlinuxtests"; - internal const string NonNetBSDTest = "nonnetbsdtests"; - internal const string NonOSXTest = "nonosxtests"; - internal const string NonWindowsTest = "nonwindowstests"; - - internal static string NonNetcoreappTest = "nonnetcoreapptests"; - internal static string NonNetfxTest = "nonnetfxtests"; - internal static string NonUapTest = "nonuaptests"; - internal static string NonMonoTest = "nonmonotests"; - - internal const string Failing = "failing"; - internal const string ActiveIssue = "activeissue"; - internal const string OuterLoop = "outerloop"; - - public const string Category = "category"; - public const string IgnoreForCI = "ignoreforci"; - public const string RequiresElevation = "requireselevation"; - } -} From a809f378c23ab212834b88867d0ac6d8b4049979 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 10 Nov 2025 13:18:45 -0400 Subject: [PATCH 04/13] User Story 40114: Release activities for v5.1.8 - Fixed ManualTests SqlBulkCopy file inclusion issues. --- ....Data.SqlClient.ManualTesting.Tests.csproj | 30 +++++++++---------- .../SQL/SqlBulkCopyTest/Helpers.cs | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) 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 c1ce4f8d00..97710bfd0c 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 @@ -117,8 +117,6 @@ - - @@ -138,32 +136,35 @@ + - + + + + + - - - - - - - - - + + - - + + + + + + + @@ -279,7 +280,6 @@ - diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/Helpers.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/Helpers.cs index e28a1d02b5..9e93be415c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/Helpers.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/Helpers.cs @@ -5,7 +5,7 @@ using System; using System.Data.Common; -namespace Microsoft.Data.SqlClient.ManualTesting.Tests +namespace Microsoft.Data.SqlClient.ManualTesting.Tests.SQL.SqlBulkCopyTest { public class Helpers { From 47bdb742836c131dcf5e0a159f2f05ab48bf5fd8 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 10 Nov 2025 14:19:22 -0400 Subject: [PATCH 05/13] User Story 40114: Release activities for v5.1.8 - Fixed MDS nuspec to look for net462 artifacts in the correct place. - Reverted SqlBulkCopy tests Helpers namespace change. --- build.proj | 2 +- .../SQL/SqlBulkCopyTest/Helpers.cs | 2 +- tools/specs/Microsoft.Data.SqlClient.nuspec | 52 ++++++++++--------- tools/targets/NotSupported.targets | 2 +- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/build.proj b/build.proj index 9714ff2b1c..f510884678 100644 --- a/build.proj +++ b/build.proj @@ -103,7 +103,7 @@ - $(DotNetCmd) dotnet build -c Release -p:ReferenceType=$(ReferenceType) + $(DotnetPath)dotnet build -c Release -p:ReferenceType=$(ReferenceType) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/Helpers.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/Helpers.cs index 9e93be415c..194321deeb 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/Helpers.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/Helpers.cs @@ -5,7 +5,7 @@ using System; using System.Data.Common; -namespace Microsoft.Data.SqlClient.ManualTesting.Tests.SQL.SqlBulkCopyTest +namespace Microsoft.Data.SqlClient.ManualTesting.Tests.SQL { public class Helpers { diff --git a/tools/specs/Microsoft.Data.SqlClient.nuspec b/tools/specs/Microsoft.Data.SqlClient.nuspec index 7e45b87cf0..574a1c500d 100644 --- a/tools/specs/Microsoft.Data.SqlClient.nuspec +++ b/tools/specs/Microsoft.Data.SqlClient.nuspec @@ -29,8 +29,9 @@ When using NuGet 3.x this package requires at least version 3.4. - - + + + @@ -41,8 +42,9 @@ When using NuGet 3.x this package requires at least version 3.4. - - + + + @@ -56,8 +58,9 @@ When using NuGet 3.x this package requires at least version 3.4. - - + + + @@ -73,8 +76,9 @@ When using NuGet 3.x this package requires at least version 3.4. - - + + + @@ -138,22 +142,20 @@ When using NuGet 3.x this package requires at least version 3.4. - - - - - - - - - - - + + + + + + + + + + - - - - + + + @@ -169,8 +171,8 @@ When using NuGet 3.x this package requires at least version 3.4. - - + + diff --git a/tools/targets/NotSupported.targets b/tools/targets/NotSupported.targets index 3be0460dd1..25e45233a2 100644 --- a/tools/targets/NotSupported.targets +++ b/tools/targets/NotSupported.targets @@ -42,7 +42,7 @@ $(GenAPIArgs) -o:"$(NotSupportedSourceFile)" $(GenAPIArgs) -t:"$(GeneratePlatformNotSupportedAssemblyMessage)" $(GenAPIArgs) -global - "$(DotNetCmd) $(ToolsArtifactsDir)net6.0\Microsoft.DotNet.GenAPI.dll" + "$(DotnetPath)dotnet" "$(ToolsArtifactsDir)net6.0\Microsoft.DotNet.GenAPI.dll" "$(ToolsArtifactsDir)net472\Microsoft.DotNet.GenAPI.exe" From fa2ba2f41729c59b8f73affb7fb22f9baf69dfe0 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 10 Nov 2025 15:07:34 -0400 Subject: [PATCH 06/13] User Story 40114: Release activities for v5.1.8 - Fixed Helpers namespace for real. - Added sunit.runner.json config to avoid XUnitExtensions strong name errors. --- .../Microsoft.Data.SqlClient.Tests.csproj | 6 ++++++ .../Microsoft.Data.SqlClient.ManualTesting.Tests.csproj | 6 ++++++ .../tests/ManualTests/SQL/SqlBulkCopyTest/Helpers.cs | 2 +- .../xunit.runner.json | 9 +++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/xunit.runner.json 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 7b72749e61..49ae9717d2 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 @@ -76,6 +76,12 @@ + + + PreserveNewest + xunit.runner.json + + 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 97710bfd0c..71c5db1306 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 @@ -297,6 +297,12 @@ + + + PreserveNewest + xunit.runner.json + + Address diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/Helpers.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/Helpers.cs index 194321deeb..e28a1d02b5 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/Helpers.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/Helpers.cs @@ -5,7 +5,7 @@ using System; using System.Data.Common; -namespace Microsoft.Data.SqlClient.ManualTesting.Tests.SQL +namespace Microsoft.Data.SqlClient.ManualTesting.Tests { public class Helpers { diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/xunit.runner.json b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/xunit.runner.json new file mode 100644 index 0000000000..42755c93ec --- /dev/null +++ b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/xunit.runner.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://xunit.net/schema/current/xunit.runner.schema.json", + "diagnosticMessages": true, + "parallelizeAssembly": true, + "shadowCopy": false, + "printMaxEnumerableLength": 0, + "printMaxStringLength": 0, + "showLiveOutput": false +} From 1fab2c60903dab8df1745dad2db3374e54eaa028 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 10 Nov 2025 15:42:55 -0400 Subject: [PATCH 07/13] User Story 40114: Release activities for v5.1.8 - Fixed SNI DLL copying for .NET Framework test projects. --- .../FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj | 4 +++- .../Microsoft.Data.SqlClient.ManualTesting.Tests.csproj | 7 ++++--- 2 files changed, 7 insertions(+), 4 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 49ae9717d2..52229d7ea2 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 @@ -120,7 +120,9 @@ - + + + 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 71c5db1306..95a4dd8723 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 @@ -340,7 +340,8 @@ - - - + + + + From 91a89ffabde98961d7a9e859456b94dbd29c9729 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 10 Nov 2025 16:06:56 -0400 Subject: [PATCH 08/13] User Story 40114: Release activities for v5.1.8 - Whoops - forget to add the new target file. --- ...DllsForNetFxProjectReferenceBuilds.targets | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tools/targets/CopySniDllsForNetFxProjectReferenceBuilds.targets diff --git a/tools/targets/CopySniDllsForNetFxProjectReferenceBuilds.targets b/tools/targets/CopySniDllsForNetFxProjectReferenceBuilds.targets new file mode 100644 index 0000000000..9526d2b2bb --- /dev/null +++ b/tools/targets/CopySniDllsForNetFxProjectReferenceBuilds.targets @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + From 9859394f1a51af04771b4360d5f9d534b9d93179 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Mon, 10 Nov 2025 19:10:00 -0400 Subject: [PATCH 09/13] User Story 40114: Release activities for v5.1.8 - Pipeline tweaks in preparation for the official 5.1.8 build. --- .../jobs/build-signed-akv-package-job.yml | 5 ++++- .../dotnet-sqlclient-signing-pipeline.yml | 22 ++++++++++--------- eng/pipelines/libraries/build-variables.yml | 2 +- eng/pipelines/libraries/mds-variables.yml | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml b/eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml index 43109253dc..910b8824a9 100644 --- a/eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml +++ b/eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml @@ -4,6 +4,9 @@ # See the LICENSE file in the project root for more information. # ################################################################################# parameters: + - name: mdsPackageVersion + type: string + - name: symbolsFolder type: string default: symbols @@ -33,7 +36,7 @@ jobs: - template: ../steps/build-all-configurations-signed-dlls-step.yml@self parameters: product: AKV - nugetPackageRefVersion: $(MDS_PackageRef_Version) + nugetPackageRefVersion: ${{ parameters.mdsPackageVersion }} AssemblyFileVersion: $(AKVAssemblyFileVersion) - template: ../steps/code-analyze-step.yml@self diff --git a/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml index b422fa7836..fe11f02128 100644 --- a/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml +++ b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml @@ -43,10 +43,13 @@ parameters: # parameters are shown up in ADO UI in a build queue time type: boolean default: false +# GOTCHA: This must be a previously published MDS package version. This +# pipeline isn't capable of using the MDS package being built as input for +# the AKV package build. - name: MDS_PackageRef_Version - displayName: 'MDS package version of AKV Provider (build AKV)' + displayName: 'Publicly available MDS package version for AKV Provider build' type: string - default: 5.1.2 + default: 5.1.7 - name: CurrentNetFxVersion displayName: 'Lowest supported .NET Framework version (MDS validation)' @@ -77,8 +80,6 @@ variables: value: drop_buildMDS_build_signed_package - name: PublishSymbols value: ${{ parameters['publishSymbols'] }} - - name: MDS_PackageRef_Version - value: ${{ parameters['MDS_PackageRef_Version'] }} - name: CurrentNetFxVersion value: ${{ parameters['CurrentNetFxVersion'] }} - name: ProductVersion #MDS product version (MDS validation) @@ -144,22 +145,23 @@ extends: tsaOptionsPath: $(REPOROOT)\.config\tsaoptions.json disableLegacyManifest: true stages: - - stage: buildAKV - displayName: 'Build AKV Provider' + - stage: buildMDS + displayName: 'Build MDS' jobs: - - template: eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml@self + - template: eng/pipelines/common/templates/jobs/build-signed-package-job.yml@self parameters: symbolsFolder: $(symbolsFolder) softwareFolder: $(softwareFolder) publishSymbols: ${{ parameters['publishSymbols'] }} - - stage: buildMDS - displayName: 'Build MDS' + - stage: buildAKV + displayName: 'Build AKV Provider' jobs: - - template: eng/pipelines/common/templates/jobs/build-signed-package-job.yml@self + - template: eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml@self parameters: symbolsFolder: $(symbolsFolder) softwareFolder: $(softwareFolder) + mdsPackageVersion: ${{ parameters['MDS_PackageRef_Version'] }} publishSymbols: ${{ parameters['publishSymbols'] }} - stage: mds_package_validation diff --git a/eng/pipelines/libraries/build-variables.yml b/eng/pipelines/libraries/build-variables.yml index 1c26f26a69..7b3b13f914 100644 --- a/eng/pipelines/libraries/build-variables.yml +++ b/eng/pipelines/libraries/build-variables.yml @@ -6,5 +6,5 @@ variables: - template: common-variables.yml@self - - template: akv-variables.yml@self - template: mds-variables.yml@self + - template: akv-variables.yml@self diff --git a/eng/pipelines/libraries/mds-variables.yml b/eng/pipelines/libraries/mds-variables.yml index 8d5e37ab83..4f4941d9b7 100644 --- a/eng/pipelines/libraries/mds-variables.yml +++ b/eng/pipelines/libraries/mds-variables.yml @@ -12,7 +12,7 @@ variables: - name: Minor value: 1 - name: Patch - value: 7 + value: 8 - name: Packaging.EnableSBOMSigning value: true From 74759434cee6dcabe6d3c98b1a2179bf4d82a2db Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Tue, 11 Nov 2025 09:24:45 -0400 Subject: [PATCH 10/13] User Story 40114: Release activities for v5.1.8 - Fixed variable -> parameter that I missed earlier. - Added target framework to paths for .NET Framework DLL copying steps --- .../templates/jobs/build-signed-akv-package-job.yml | 2 +- .../common/templates/steps/copy-dlls-for-test-step.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml b/eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml index 910b8824a9..8c0d31e5d1 100644 --- a/eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml +++ b/eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml @@ -43,7 +43,7 @@ jobs: parameters: analyzeType: all product: AKV - nugetPackageRefVersion: $(MDS_PackageRef_Version) + nugetPackageRefVersion: ${{ parameters.mdsPackageVersion }} - template: ../steps/esrp-code-signing-step.yml@self parameters: diff --git a/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml b/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml index ec1ac1f94f..63ea0649ac 100644 --- a/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml +++ b/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml @@ -58,7 +58,7 @@ steps: if ($tf.StartsWith('net4')) { - Copy-Item "artifacts\${{parameters.referenceType }}\bin\Windows_NT\${{parameters.Configuration }}.AnyCPU\Microsoft.Data.SqlClient\netfx\Microsoft.Data.SqlClient.dll" "$software\win\$tf" -recurse + Copy-Item "artifacts\${{parameters.referenceType }}\bin\Windows_NT\${{parameters.Configuration }}.AnyCPU\Microsoft.Data.SqlClient\netfx\$tf\Microsoft.Data.SqlClient.dll" "$software\win\$tf" -recurse } else { @@ -70,16 +70,16 @@ steps: if ($tf.StartsWith('net4')) { - Copy-Item "artifacts\Project\bin\Windows_NT\Release.AnyCPU\Microsoft.Data.SqlClient\netfx\Microsoft.Data.SqlClient.pdb" "$symbols\win\$tf" -recurse + Copy-Item "artifacts\${{parameters.referenceType }}\bin\Windows_NT\${{parameters.Configuration }}.AnyCPU\Microsoft.Data.SqlClient\netfx\$tf\Microsoft.Data.SqlClient.pdb" "$symbols\win\$tf" -recurse } else { - Copy-Item "artifacts\Project\bin\Windows_NT\Release.AnyCPU\Microsoft.Data.SqlClient\netcore\$tf\Microsoft.Data.SqlClient.pdb" "$symbols\win\$tf" -recurse + Copy-Item "artifacts\${{parameters.referenceType }}\bin\Windows_NT\${{parameters.Configuration }}.AnyCPU\Microsoft.Data.SqlClient\netcore\$tf\Microsoft.Data.SqlClient.pdb" "$symbols\win\$tf" -recurse } Write-Host "Artifacts fetched for testing" Get-Location - displayName: 'Prepare ${{ targetFramework }} Arifacts for Testing' + displayName: 'Prepare ${{ targetFramework }} Artifacts for Testing' - ${{ if eq(parameters.product, 'AKV') }}: - powershell: | @@ -96,7 +96,7 @@ steps: Write-Host "Artifacts fetched for testing" Get-Location - displayName: 'Prepare ${{ targetFramework }} Arifacts for Testing' + displayName: 'Prepare ${{ targetFramework }} Artifacts for Testing' - powershell: | $software = '${{parameters.softwareFolder}}' From 4f159cc6e7771ba8dcb28250a4c16c1de10e4e0b Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Tue, 11 Nov 2025 11:29:40 -0400 Subject: [PATCH 11/13] User Story 40114: Release activities for v5.1.8 - Ignoring ADO Library variables for NuGet and assembly versioning. --- eng/pipelines/libraries/akv-variables.yml | 20 +++++++++++++++----- eng/pipelines/libraries/mds-variables.yml | 19 ++++++++++++++----- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/eng/pipelines/libraries/akv-variables.yml b/eng/pipelines/libraries/akv-variables.yml index a4aa80d555..eefd829121 100644 --- a/eng/pipelines/libraries/akv-variables.yml +++ b/eng/pipelines/libraries/akv-variables.yml @@ -6,16 +6,26 @@ variables: - group: AKV Release Variables - - name: AKVMajor + + # The above Library contains variables named AKVMajor, AKVMinor, and AKVPatch. + # We don't want to use those (since they are shared with other pipelines), so + # we specify our own variables here. These are the only variables that affect + # the NuGet package version and assembly version for AKV official builds for + # this branch (5.1). + # + # There are other variables in that Library that we still need, so we can't + # omit it entirely. + # + - name: LocalAkvMajor value: 5 - - name: AKVMinor + - name: LocalAkvMinor value: 1 - - name: AKVPatch + - name: LocalAkvPatch value: 0 - name: AKVNugetPackageVersion - value: $(AKVMajor).$(AKVMinor).$(AKVPatch) + value: $(LocalAkvMajor).$(LocalAkvMinor).$(LocalAkvPatch) - name: AKVAssemblyFileVersion - value: '$(AKVMajor).$(AKVMinor)$(AKVPatch).$(Build.BuildNumber)' + value: '$(LocalAkvMajor).$(LocalAkvMinor)$(LocalAkvPatch).$(Build.BuildNumber)' - name: akvNuspecPath value: tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec diff --git a/eng/pipelines/libraries/mds-variables.yml b/eng/pipelines/libraries/mds-variables.yml index 4f4941d9b7..e32c298ae8 100644 --- a/eng/pipelines/libraries/mds-variables.yml +++ b/eng/pipelines/libraries/mds-variables.yml @@ -7,18 +7,27 @@ variables: - group: Release Variables - - name: Major + # The above Library contains variables named Major, Minor, and Patch. We + # don't want to use those (since they are shared with other pipelines), so we + # specify our own variables here. These are the only variables that affect + # the NuGet package version and assembly version for MDS official builds for + # this branch (5.1). + # + # There are other variables in that Library that we still need, so we can't + # omit it entirely. + # + - name: LocalMdsMajor value: 5 - - name: Minor + - name: LocalMdsMinor value: 1 - - name: Patch + - name: LocalMdsPatch value: 8 - name: Packaging.EnableSBOMSigning value: true - name: NugetPackageVersion - value: $(Major).$(Minor).$(Patch) + value: $(LocalMdsMajor).$(LocalMdsMinor).$(LocalMdsPatch) - name: AssemblyFileVersion - value: '$(Major).$(Minor)$(Patch).$(Build.BuildNumber)' + value: '$(LocalMdsMajor).$(LocalMdsMinor)$(LocalMdsPatch).$(Build.BuildNumber)' - name: nuspecPath value: '$(REPOROOT)/tools/specs/Microsoft.Data.SqlClient.nuspec' From abb40877009ca4a138de7a9ebcc4202994ba2178 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Wed, 12 Nov 2025 14:35:08 -0400 Subject: [PATCH 12/13] - Rolled back some packages to the newest versions that don't include major version bumps for transitive packages. - Left breadcrumbs indicating why we're including Azure.Core explicitly. --- .../netcore/ref/Microsoft.Data.SqlClient.csproj | 6 +++++- .../netcore/src/Microsoft.Data.SqlClient.csproj | 6 +++++- .../netfx/ref/Microsoft.Data.SqlClient.csproj | 6 +++++- .../netfx/src/Microsoft.Data.SqlClient.csproj | 6 +++++- .../Microsoft.Data.SqlClient.Tests.csproj | 1 + .../SQL/ExceptionTest/ConnectionExceptionTest.cs | 8 +++++++- .../ManualTests/SQL/LocalDBTest/LocalDBTest.cs | 8 +++++++- ...Microsoft.Data.SqlClient.TestUtilities.csproj | 3 ++- tools/props/Versions.props | 6 +++--- tools/specs/Microsoft.Data.SqlClient.nuspec | 16 ++++++++++++++++ 10 files changed, 56 insertions(+), 10 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj index d57f2ab31a..7ef9ff4f78 100644 --- a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj @@ -55,8 +55,12 @@ - + + diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj index 9f4bd23ad4..77b2470387 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj @@ -969,8 +969,12 @@ - + + diff --git a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj index a13e9a0a67..ec678e21f7 100644 --- a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj @@ -38,8 +38,12 @@ - + + diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj index 4b711dc61d..bceff2fc4c 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj @@ -713,8 +713,12 @@ - + + 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 52229d7ea2..2336768391 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 @@ -86,6 +86,7 @@ + diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs index a58764f51e..e795640e23 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs @@ -144,7 +144,13 @@ public void NamedPipeInvalidConnStringTest() } [Fact] - [SkipOnTargetFramework(~(TargetFrameworkMonikers)0x4)] + [SkipOnTargetFramework( + // We had defined Uap to be 0x4 in our fork/copy of XUnitExtensions. + // Now that we're using the NuGet package, I can't add enum members, + // so I kept the functionality here by casting from the old raw + // value. XUnitExtensions's TargetFrameworkMonikers currently only + // includes enum values up to 0x2, so this is safe - for now. + ~(TargetFrameworkMonikers)0x4)] public static void LocalDBNotSupportedOnUapTest() { SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(@$"server=(localdb)\{DataTestUtility.LocalDbAppName}") diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs index f0f15c20cb..6059d0ec6c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs @@ -27,7 +27,13 @@ private enum InfoType private static readonly string s_localDbNamedPipeConnectionString = @$"server={GetLocalDbNamedPipe()}"; #region LocalDbTests - [SkipOnTargetFramework((TargetFrameworkMonikers)0x4)] // No Registry support on UAP + [SkipOnTargetFramework( + // We had defined Uap to be 0x4 in our fork/copy of XUnitExtensions. + // Now that we're using the NuGet package, I can't add enum members, + // so I kept the functionality here by casting from the old raw + // value. XUnitExtensions's TargetFrameworkMonikers currently only + // includes enum values up to 0x2, so this is safe - for now. + (TargetFrameworkMonikers)0x4)] // No Registry support on UAP [ConditionalFact(nameof(IsLocalDBEnvironmentSet))] public static void SqlLocalDbConnectionTest() { diff --git a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj index 379dd4cb96..1ca32f6754 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj +++ b/src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Microsoft.Data.SqlClient.TestUtilities.csproj @@ -14,8 +14,9 @@ PreserveNewest + - \ No newline at end of file + diff --git a/tools/props/Versions.props b/tools/props/Versions.props index e166006cdf..b8a6172ba7 100644 --- a/tools/props/Versions.props +++ b/tools/props/Versions.props @@ -28,7 +28,7 @@ 1.12.1 - 4.78.0 + 4.76.0 6.35.0 6.35.0 4.5.1 @@ -55,8 +55,8 @@ - 1.45.0 - 4.7.0 + 1.41.0 + 4.6.0 6.0.3 4.3.2 diff --git a/tools/specs/Microsoft.Data.SqlClient.nuspec b/tools/specs/Microsoft.Data.SqlClient.nuspec index 574a1c500d..dd1a470b5f 100644 --- a/tools/specs/Microsoft.Data.SqlClient.nuspec +++ b/tools/specs/Microsoft.Data.SqlClient.nuspec @@ -29,6 +29,10 @@ When using NuGet 3.x this package requires at least version 3.4. + @@ -42,6 +46,10 @@ When using NuGet 3.x this package requires at least version 3.4. + @@ -58,6 +66,10 @@ When using NuGet 3.x this package requires at least version 3.4. + @@ -76,6 +88,10 @@ When using NuGet 3.x this package requires at least version 3.4. + From 349d0e0622738902e649494879359b6a39752af5 Mon Sep 17 00:00:00 2001 From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com> Date: Wed, 12 Nov 2025 15:52:41 -0400 Subject: [PATCH 13/13] Fixed nuspec files to match updated dependencies. --- tools/specs/Microsoft.Data.SqlClient.nuspec | 16 ++++++++-------- ....AlwaysEncrypted.AzureKeyVaultProvider.nuspec | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/specs/Microsoft.Data.SqlClient.nuspec b/tools/specs/Microsoft.Data.SqlClient.nuspec index dd1a470b5f..1260b66326 100644 --- a/tools/specs/Microsoft.Data.SqlClient.nuspec +++ b/tools/specs/Microsoft.Data.SqlClient.nuspec @@ -33,9 +33,9 @@ When using NuGet 3.x this package requires at least version 3.4. Azure.Core is explicitly referenced to avoid a transitive dependency on a vulnerable version via Azure.Identity. --> - + - + @@ -50,9 +50,9 @@ When using NuGet 3.x this package requires at least version 3.4. Azure.Core is explicitly referenced to avoid a transitive dependency on a vulnerable version via Azure.Identity. --> - + - + @@ -70,9 +70,9 @@ When using NuGet 3.x this package requires at least version 3.4. Azure.Core is explicitly referenced to avoid a transitive dependency on a vulnerable version via Azure.Identity. --> - + - + @@ -92,9 +92,9 @@ When using NuGet 3.x this package requires at least version 3.4. Azure.Core is explicitly referenced to avoid a transitive dependency on a vulnerable version via Azure.Identity. --> - + - + diff --git a/tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec b/tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec index 2a18f80358..b7c06d9b80 100644 --- a/tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec +++ b/tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec @@ -26,23 +26,23 @@ Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyStoreProvider.SqlColumnEncrypti - + - + - + - + - + - +