diff --git a/build.proj b/build.proj index 3eb78ec047..c29dec53a1 100644 --- a/build.proj +++ b/build.proj @@ -139,7 +139,7 @@ - + + - PackLogging;PackAbstractions;PackSqlServer + PackLogging;PackAbstractions;PackSqlServer - + "$(DotnetPath)dotnet" build $(SqlClientProjectPath) -p:Configuration=$(Configuration) - -p:TargetOs=Unix $(SigningKeyPathArgument) @@ -534,36 +533,7 @@ $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - - PackLogging;PackAbstractions;PackSqlServer - - - - - "$(DotnetPath)dotnet" build $(SqlClientProjectPath) - -p:Configuration=$(Configuration) - -p:TargetOs=Windows_NT - $(SigningKeyPathArgument) - - - $(BuildNumberArgument) - $(BuildSuffixArgument) - $(PackageVersionSqlClientArgument) - - - $(ReferenceTypeArgument) - $(PackageVersionSqlServerArgument) - - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - + @@ -1212,14 +1182,11 @@ - - - + "$(DotnetPath)dotnet" build "$(SqlClientUnitTestProjectPath)" -p:Configuration=$(Configuration) - -p:TargetOs=Unix $(ReferenceTypeArgument) @@ -1229,60 +1196,17 @@ $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - - - "$(DotnetPath)dotnet" build "$(SqlClientUnitTestProjectPath)" - -p:Configuration=$(Configuration) - -p:TargetOs=Windows_NT - - - $(ReferenceTypeArgument) - $(TestSigningKeyPathArgument) - $(PackageVersionSqlClientArgument) - $(PackageVersionSqlServerArgument) - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - + - - - - - - "$(DotnetPath)dotnet" build "$(SqlClientFunctionalTestProjectPath)" - -p:Configuration=$(Configuration) - -p:TargetOs=Unix - - - $(ReferenceTypeArgument) - $(PackageVersionAbstractionsArgument) - $(PackageVersionLoggingArgument) - $(PackageVersionSqlClientArgument) - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - + "$(DotnetPath)dotnet" build "$(SqlClientFunctionalTestProjectPath)" -p:Configuration=$(Configuration) - -p:TargetOs=Windows_NT $(ReferenceTypeArgument) @@ -1292,41 +1216,17 @@ $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - + - - - - - - "$(DotnetPath)dotnet" build "$(SqlClientManualTestProjectPath)" - -p:Configuration=$(Configuration) - -p:TargetOs=Unix - - - $(ReferenceTypeArgument) - $(PackageVersionAbstractionsArgument) - $(PackageVersionLoggingArgument) - $(PackageVersionSqlClientArgument) - $(PackageVersionSqlServerArgument) - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - + "$(DotnetPath)dotnet" build "$(SqlClientManualTestProjectPath)" -p:Configuration=$(Configuration) - -p:TargetOs=Windows_NT $(ReferenceTypeArgument) @@ -1337,20 +1237,17 @@ $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - + - - - + "$(DotnetPath)dotnet" build "$(SqlClientPerformanceTestProjectPath)" -p:Configuration=$(Configuration) - -p:TargetOs=Unix $(ReferenceTypeArgument) @@ -1360,40 +1257,17 @@ $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - - - "$(DotnetPath)dotnet" build "$(SqlClientPerformanceTestProjectPath)" - -p:Configuration=$(Configuration) - -p:TargetOs=Windows_NT - - - $(ReferenceTypeArgument) - $(PackageVersionAbstractionsArgument) - $(PackageVersionLoggingArgument) - $(PackageVersionSqlClientArgument) - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - + - - - + "$(DotnetPath)dotnet" build "$(SqlClientStressTestProjectPath)" -p:Configuration=$(Configuration) - -p:TargetOs=Unix $(ReferenceTypeArgument) @@ -1403,58 +1277,17 @@ $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - - - "$(DotnetPath)dotnet" build "$(SqlClientStressTestProjectPath)" - -p:Configuration=$(Configuration) - -p:TargetOs=Windows_NT - - - $(ReferenceTypeArgument) - $(PackageVersionAbstractionsArgument) - $(PackageVersionLoggingArgument) - $(PackageVersionSqlClientArgument) - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - + - - - - - - "$(DotnetPath)dotnet" build "$(AzureTestProjectPath)" - -p:Configuration=$(Configuration) - -p:TargetOs=Unix - - - $(ReferenceTypeArgument) - $(PackageVersionSqlClientArgument) - - $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - - - - - - - + "$(DotnetPath)dotnet" build "$(AzureTestProjectPath)" -p:Configuration=$(Configuration) - -p:TargetOs=Windows_NT $(ReferenceTypeArgument) @@ -1462,7 +1295,7 @@ $([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " ")) - + diff --git a/eng/pipelines/ci/kerberos/build-and-test-steps.yml b/eng/pipelines/ci/kerberos/build-and-test-steps.yml index 307c93f978..dbb3b5e1e2 100644 --- a/eng/pipelines/ci/kerberos/build-and-test-steps.yml +++ b/eng/pipelines/ci/kerberos/build-and-test-steps.yml @@ -7,8 +7,6 @@ # Shared build-and-test steps used by both the Windows and Linux Kerberos jobs. # # Parameters: -# buildTarget — The build.proj target that builds SqlClient for the current -# OS (e.g. BuildSqlClientWindows or BuildSqlClientUnix). # testFramework — The TFM to test against (e.g. net9.0, net462). # testRunTitle — Title for the published test results (displayed in the ADO # Tests tab). @@ -17,10 +15,6 @@ parameters: - # build.proj target to build SqlClient for the current OS. - - name: buildTarget - type: string - # TFM to pass to the test targets (-p:TestFramework). - name: testFramework type: string @@ -39,7 +33,7 @@ steps: # Build # --------------------------------------------------------------------------- - # Build the given target. + # Build SqlClient. # # The test stages build as part of their targets, but this separate step isolates build failures # so we can fail fast before running tests. Retries are enabled intentionally (1 attempt for @@ -52,7 +46,7 @@ steps: command: build projects: build.proj arguments: >- - -t:${{ parameters.buildTarget }} + -t:BuildSqlClient -p:Configuration=Release # --------------------------------------------------------------------------- diff --git a/eng/pipelines/ci/kerberos/sqlclient-ci-kerberos-pipeline.yml b/eng/pipelines/ci/kerberos/sqlclient-ci-kerberos-pipeline.yml index b8c28c604d..6bdea0157f 100644 --- a/eng/pipelines/ci/kerberos/sqlclient-ci-kerberos-pipeline.yml +++ b/eng/pipelines/ci/kerberos/sqlclient-ci-kerberos-pipeline.yml @@ -182,7 +182,6 @@ stages: # --- Build and test --- - template: /eng/pipelines/ci/kerberos/build-and-test-steps.yml@self parameters: - buildTarget: BuildSqlClientWindows testFramework: $(testFramework) testRunTitle: Windows-$(testFramework)-ManagedSNI_$(managedSNI) artifactName: $(testFramework)-ManagedSNI_$(managedSNI)-$(System.JobId) @@ -271,7 +270,6 @@ stages: # --- Build and test --- - template: /eng/pipelines/ci/kerberos/build-and-test-steps.yml@self parameters: - buildTarget: BuildSqlClientUnix testFramework: $(testFramework) testRunTitle: Linux-$(testFramework) artifactName: $(testFramework)-linux-$(System.JobId) diff --git a/src/Microsoft.Data.SqlClient.Extensions/Azure/test/Azure.Test.csproj b/src/Microsoft.Data.SqlClient.Extensions/Azure/test/Azure.Test.csproj index 5d6780414b..79372ca2d8 100644 --- a/src/Microsoft.Data.SqlClient.Extensions/Azure/test/Azure.Test.csproj +++ b/src/Microsoft.Data.SqlClient.Extensions/Azure/test/Azure.Test.csproj @@ -10,13 +10,7 @@ - net8.0;net9.0;net10.0 - - - $(OS) - - - $(TargetFrameworks);net462 + net462;net8.0;net9.0;net10.0 diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj index b1e20685a1..c81f18031b 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj +++ b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj @@ -4,30 +4,9 @@ Microsoft.Data.SqlClient - - - - - $(OS) - - - - - - - - - - $(TargetOs.ToLower()) - - - net8.0;net9.0 - - - - $(TargetFrameworks);net462 + net462;net8.0;net9.0 @@ -84,7 +63,7 @@ - $(ArtifactPath)$(AssemblyName)/$(ReferenceType)-$(Configuration)/$(NormalizedTargetOs)/ + $(ArtifactPath)$(AssemblyName)/$(ReferenceType)-$(Configuration)/ diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.nuspec b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.nuspec index 09a556d84a..9a0cf9e885 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.nuspec +++ b/src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.nuspec @@ -136,24 +136,24 @@ - - - + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -161,20 +161,19 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -182,20 +181,19 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -220,25 +218,27 @@ + + - - + + - - + + - - + + - - + + - - + + diff --git a/src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj b/src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj index b46b464428..46f1dafb1d 100644 --- a/src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj +++ b/src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj @@ -23,13 +23,7 @@ - net8.0;net9.0;net10.0 - - - $(OS) - - - $(TargetFrameworks);net462 + net462;net8.0;net9.0;net10.0 diff --git a/src/Microsoft.Data.SqlClient/tests/CustomConfigurableRetryLogic/CustomRetryLogicProvider.csproj b/src/Microsoft.Data.SqlClient/tests/CustomConfigurableRetryLogic/CustomRetryLogicProvider.csproj index ca037a50bf..9522076415 100644 --- a/src/Microsoft.Data.SqlClient/tests/CustomConfigurableRetryLogic/CustomRetryLogicProvider.csproj +++ b/src/Microsoft.Data.SqlClient/tests/CustomConfigurableRetryLogic/CustomRetryLogicProvider.csproj @@ -6,13 +6,7 @@ - net8.0;net9.0;net10.0 - - - $(OS) - - - $(TargetFrameworks);net462 + net462;net8.0;net9.0;net10.0 diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj index c681d91dc7..e22d6430d9 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.FunctionalTests.csproj @@ -8,13 +8,7 @@ - net8.0;net9.0;net10.0 - - - $(OS) - - - $(TargetFrameworks);net462 + net462;net8.0;net9.0;net10.0 diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj index be691606ce..e8dc221092 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj @@ -8,13 +8,7 @@ - net8.0;net9.0;net10.0 - - - $(OS) - - - $(TargetFrameworks);net462 + net462;net8.0;net9.0;net10.0 diff --git a/src/Microsoft.Data.SqlClient/tests/PerformanceTests/Microsoft.Data.SqlClient.PerformanceTests.csproj b/src/Microsoft.Data.SqlClient/tests/PerformanceTests/Microsoft.Data.SqlClient.PerformanceTests.csproj index 1acb981002..aced0f5bf0 100644 --- a/src/Microsoft.Data.SqlClient/tests/PerformanceTests/Microsoft.Data.SqlClient.PerformanceTests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/PerformanceTests/Microsoft.Data.SqlClient.PerformanceTests.csproj @@ -7,6 +7,16 @@ Microsoft.Data.SqlClient.PerformanceTests.Program + + + + $(DefineConstants);WINDOWS + + @@ -74,15 +84,9 @@ + - - - - - - - $(DefineConstants);WINDOWS - diff --git a/src/Microsoft.Data.SqlClient/tests/PerformanceTests/Program.cs b/src/Microsoft.Data.SqlClient/tests/PerformanceTests/Program.cs index b5ef4d76c6..5a0d303e97 100644 --- a/src/Microsoft.Data.SqlClient/tests/PerformanceTests/Program.cs +++ b/src/Microsoft.Data.SqlClient/tests/PerformanceTests/Program.cs @@ -131,7 +131,7 @@ private static bool IsHarnessControlled() => private void SetupConfigurations() { - // If the config file specifies to use managed SNI on Windows, + // If the config file specifies to use managed SNI on Windows, // enable the appropriate AppContext switch to use the managed SNI implementation. if (_config.UseManagedSniOnWindows) { @@ -146,8 +146,8 @@ private void SetupConfigurations() "Switch.Microsoft.Data.SqlClient.UseConnectionPoolV2", _config.UseConnectionPoolV2); - // If the config file specifies to use optimized async behavior, - // enable packet multiplexing feature and other optimizations in SqlClient + // If the config file specifies to use optimized async behavior, + // enable packet multiplexing feature and other optimizations in SqlClient // by setting the appropriate AppContext switches. if(_config.UseOptimizedAsyncBehaviour) { @@ -160,7 +160,7 @@ private void SetupConfigurations() // diagnosers when building each benchmark's ManualConfig. BenchmarkConfig.UseNativeMemoryAndEtwProfiler = _config.UseNativeMemoryAndETWProfiler; - // If the config file specifies to wait for a profiler, + // If the config file specifies to wait for a profiler, // display the process ID and wait for user input before starting the benchmarks. // Skipped under harness-controlled execution (PERF_LIST_BENCHMARKS / PERF_BENCHMARK): // those modes run unattended, so blocking on Console.ReadKey() would hang automation. diff --git a/src/Microsoft.Data.SqlClient/tests/PerformanceTests/runnerconfig.jsonc b/src/Microsoft.Data.SqlClient/tests/PerformanceTests/runnerconfig.jsonc index 5df16e3ff5..0ecc44e957 100644 --- a/src/Microsoft.Data.SqlClient/tests/PerformanceTests/runnerconfig.jsonc +++ b/src/Microsoft.Data.SqlClient/tests/PerformanceTests/runnerconfig.jsonc @@ -8,7 +8,7 @@ // first time a pool is created), so comparing the two pools requires two runs: // once with this flag false (legacy) and once true (new). See issue #3356. "UseConnectionPoolV2": false, - // Enable this flag to enable optimized async behavior in SqlClient. + // Enable this flag to enable optimized async behavior in SqlClient. // This is useful for benchmarking packet multiplexing and async performance improvements. "UseOptimizedAsyncBehaviour": true, // Enable this flag to get prompted to attach a profiler when running the performance tests. @@ -20,7 +20,7 @@ // Note: This flag cannot be enabled on non-Windows OSes as the NativeMemoryProfiler is not supported on non-Windows OSes. "UseNativeMemoryAndETWProfiler": false, // This section contains the configuration for each benchmark. - // You can enable/disable benchmarks and configure the number of iterations, invocations, + // You can enable/disable benchmarks and configure the number of iterations, invocations, // warmup runs, and row count for each benchmark. // // Two optional per-benchmark settings are available for slow benchmarks: diff --git a/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Build.props b/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Build.props index 93c1f10d93..42f1e2c1a7 100644 --- a/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Build.props +++ b/src/Microsoft.Data.SqlClient/tests/StressTests/Directory.Build.props @@ -11,13 +11,7 @@ $(MSBuildThisFileDirectory) - net8.0;net9.0;net10.0 - - - $(OS) - - - $(TargetFrameworks);net462 + net462;net8.0;net9.0;net10.0 - net8.0;net9.0;net10.0 - - - $(OS) - - - $(TargetFrameworks);net462 + net462;net8.0;net9.0;net10.0 diff --git a/src/Microsoft.Data.SqlClient/tests/TestUdts/Circle/Circle.csproj b/src/Microsoft.Data.SqlClient/tests/TestUdts/Circle/Circle.csproj index e19c8b40a5..d2bcf8c7e8 100644 --- a/src/Microsoft.Data.SqlClient/tests/TestUdts/Circle/Circle.csproj +++ b/src/Microsoft.Data.SqlClient/tests/TestUdts/Circle/Circle.csproj @@ -6,13 +6,7 @@ - net8.0;net9.0;net10.0 - - - $(OS) - - - $(TargetFrameworks);net462 + net462;net8.0;net9.0;net10.0 diff --git a/src/Microsoft.Data.SqlClient/tests/TestUdts/Shapes/Shapes.csproj b/src/Microsoft.Data.SqlClient/tests/TestUdts/Shapes/Shapes.csproj index d8c2d66253..594304b37d 100644 --- a/src/Microsoft.Data.SqlClient/tests/TestUdts/Shapes/Shapes.csproj +++ b/src/Microsoft.Data.SqlClient/tests/TestUdts/Shapes/Shapes.csproj @@ -6,13 +6,7 @@ - net8.0;net9.0;net10.0 - - - $(OS) - - - $(TargetFrameworks);net462 + net462;net8.0;net9.0;net10.0 diff --git a/src/Microsoft.Data.SqlClient/tests/TestUdts/Utf8String/Utf8String.csproj b/src/Microsoft.Data.SqlClient/tests/TestUdts/Utf8String/Utf8String.csproj index cc41b9fb47..2752cb37ff 100644 --- a/src/Microsoft.Data.SqlClient/tests/TestUdts/Utf8String/Utf8String.csproj +++ b/src/Microsoft.Data.SqlClient/tests/TestUdts/Utf8String/Utf8String.csproj @@ -6,13 +6,7 @@ - net8.0;net9.0;net10.0 - - - $(OS) - - - $(TargetFrameworks);net462 + net462;net8.0;net9.0;net10.0 diff --git a/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj b/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj index 04afcf3910..4111f701f4 100644 --- a/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj @@ -9,13 +9,7 @@ - net8.0;net9.0;net10.0 - - - $(OS) - - - $(TargetFrameworks);net462 + net462;net8.0;net9.0;net10.0 @@ -56,13 +50,15 @@ compile asset and reference the runtime DLL directly so the compiler can see internals. TODO: This is fragile, depending on our SqlClient NuGet package layout and supported TFMs. It - is only necessary because we produce ref and not-supported assemblies and package them. By - default, the compiler will use the ref assemblies if present, which we must explicitly override - as explained above. + is only necessary because we produce ref and not-supported assemblies and package them. By + default, the compiler will use the ref assemblies if present, which we must explicitly override + as explained above. + --> + - <_SqlClientRid Condition="'$(TargetOs)' != 'Windows_NT'">unix - <_SqlClientRid Condition="'$(TargetOs)' == 'Windows_NT'">win <_SqlClientPackageTfm Condition="'$(TargetFramework)' == 'net8.0'">net8.0 <_SqlClientPackageTfm Condition="'$(TargetFramework)' == 'net462'">net462 @@ -80,7 +76,7 @@ exposed via InternalsVisibleTo. The path uses $(PkgMicrosoft_Data_SqlClient) generated above to locate the runtime DLL inside the NuGet package layout. --> + HintPath="$(PkgMicrosoft_Data_SqlClient)/runtimes/win/lib/$(_SqlClientPackageTfm)/Microsoft.Data.SqlClient.dll" /> diff --git a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/SSPI/SSPIContext.Unix.cs b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/SSPI/SSPIContext.Unix.cs deleted file mode 100644 index 3221d9cbcd..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/SSPI/SSPIContext.Unix.cs +++ /dev/null @@ -1,109 +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.ComponentModel; -using System.Runtime.InteropServices; -using System.Security.Principal; - -namespace Microsoft.SqlServer.TDS.EndPoint.SSPI -{ - /// - /// SSPI context - /// - public class SSPIContext : IDisposable - { - /// - /// FInalizer - /// - ~SSPIContext() - { - // Indicate that we're being destructed - Dispose(false); - } - - /// - /// Create SSPI context for server - /// - public static SSPIContext CreateServer() - { - throw new PlatformNotSupportedException(); - } - - /// - /// Create SSPI context for client - /// - public static SSPIContext CreateClient() - { - throw new PlatformNotSupportedException(); - } - - /// - /// Initialize authentication sequence for the server - /// - /// Token received from the client - /// Token to be sent to the client in response - public SSPIResponse StartServerAuthentication(byte[] clientToken) - { - throw new PlatformNotSupportedException(); - } - - /// - /// Continue authentication sequence for the server - /// - /// Token received from the client - /// Token to be sent to the client in response - public SSPIResponse ContinueServerAuthentication(byte[] clientToken) - { - throw new PlatformNotSupportedException(); - } - - /// - /// Initialize authentication sequence for the client - /// - /// Token to be sent to the server - public SSPIResponse StartClientAuthentication(string targetMachine, uint targetPort) - { - throw new PlatformNotSupportedException(); - } - - /// - /// Initialize authentication sequence for the client - /// - /// Payload received from the server - /// Token to be sent to the server - public SSPIResponse ContinueClientAuthentication(byte[] clientToken) - { - throw new PlatformNotSupportedException(); - } - - /// - /// Return identity of the party on the other end - /// - /// - public IIdentity GetRemoteIdentity() - { - throw new PlatformNotSupportedException(); - } - - /// - /// Dispose - /// - public void Dispose() - { - // Indicate that we're disposing - Dispose(true); - } - - /// - /// Dispose the instance - /// - /// - protected void Dispose(bool bIsDisposing) - { - - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/SSPI/SSPIContext.Windows.cs b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/SSPI/SSPIContext.cs similarity index 96% rename from src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/SSPI/SSPIContext.Windows.cs rename to src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/SSPI/SSPIContext.cs index 37f93d9f42..3d4174a6c3 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/SSPI/SSPIContext.Windows.cs +++ b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/SSPI/SSPIContext.cs @@ -45,11 +45,21 @@ public class SSPIContext : IDisposable /// private int _maxTokenBufferSize; + private static void ThrowIfNotWindows() + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + throw new PlatformNotSupportedException("SSPI authentication is only supported on Windows."); + } + } + /// /// Default constructor /// private SSPIContext() { + ThrowIfNotWindows(); + // Prepare a list of packages IList packages = new List(); @@ -126,6 +136,8 @@ private SSPIContext() /// public static SSPIContext CreateServer() { + ThrowIfNotWindows(); + // Create an instance of the context SSPIContext context = new SSPIContext(); @@ -150,6 +162,8 @@ public static SSPIContext CreateServer() /// public static SSPIContext CreateClient() { + ThrowIfNotWindows(); + // Create an instance of the context SSPIContext context = new SSPIContext(); @@ -176,6 +190,8 @@ public static SSPIContext CreateClient() /// Token to be sent to the client in response public SSPIResponse StartServerAuthentication(byte[] clientToken) { + ThrowIfNotWindows(); + // Wrap client token with the security buffer SecBufferDesc clientSecBuffer = new SecBufferDesc(clientToken); @@ -236,6 +252,8 @@ public SSPIResponse StartServerAuthentication(byte[] clientToken) /// Token to be sent to the client in response public SSPIResponse ContinueServerAuthentication(byte[] clientToken) { + ThrowIfNotWindows(); + // Wrap client token with the security buffer SecBufferDesc clientSecBuffer = new SecBufferDesc(clientToken); @@ -295,6 +313,8 @@ public SSPIResponse ContinueServerAuthentication(byte[] clientToken) /// Token to be sent to the server public SSPIResponse StartClientAuthentication(string targetMachine, uint targetPort) { + ThrowIfNotWindows(); + // Save the server we're authenticating against _targetMachineSPN = string.Format("MSSQLSvc/{0}:{1}", targetMachine, targetPort); @@ -350,6 +370,8 @@ public SSPIResponse StartClientAuthentication(string targetMachine, uint targetP /// Token to be sent to the server public SSPIResponse ContinueClientAuthentication(byte[] clientToken) { + ThrowIfNotWindows(); + // Wrap client token with the security buffer SecBufferDesc serverSecBuffer = new SecBufferDesc(clientToken); @@ -414,6 +436,8 @@ public SSPIResponse ContinueClientAuthentication(byte[] clientToken) /// public IIdentity GetRemoteIdentity() { + ThrowIfNotWindows(); + IntPtr token = IntPtr.Zero; // Delegate into security API @@ -434,6 +458,8 @@ public IIdentity GetRemoteIdentity() /// public void Dispose() { + ThrowIfNotWindows(); + // Indicate that we're disposing Dispose(true); } diff --git a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj index aaede5846b..cd68ab9016 100644 --- a/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj +++ b/src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.EndPoint/TDS.EndPoint.csproj @@ -12,53 +12,6 @@ $(TestSigningKeyPath) - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -