From 035aec1ab54d8624eb194e4557826346a19d239a Mon Sep 17 00:00:00 2001 From: Erik Ejlskov Jensen Date: Tue, 7 May 2024 13:16:54 +0200 Subject: [PATCH] Remove NET7_0 usage --- .../src/Common/src/Interop/Windows/Interop.Libraries.cs | 2 +- .../netcore/src/Microsoft/Data/SqlClient/SNI/SNICommon.cs | 4 ++-- .../netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs | 2 +- .../netcore/src/Microsoft/Data/SqlClient/SqlDataReader.cs | 2 +- .../netcore/src/Microsoft/Data/SqlClient/TdsParser.cs | 8 ++++---- .../Data/SqlClient/TdsParserStateObjectManaged.cs | 2 +- .../Data/SqlClient/SSPI/NegotiateSSPIContextProvider.cs | 2 +- .../src/Microsoft/Data/SqlClient/Server/ValueUtilsSmi.cs | 4 ++-- .../src/Microsoft/Data/SqlClient/SqlBuffer.cs | 2 +- .../tests/ManualTests/DataCommon/DataTestUtility.cs | 2 +- .../SQL/TransactionTest/DistributedTransactionTest.cs | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/Interop.Libraries.cs b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/Interop.Libraries.cs index 40308195e7..f3c5526e0f 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/Interop.Libraries.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Common/src/Interop/Windows/Interop.Libraries.cs @@ -9,7 +9,7 @@ internal static partial class Libraries internal const string Crypt32 = "crypt32.dll"; internal const string Kernel32 = "kernel32.dll"; internal const string NtDll = "ntdll.dll"; -#if !NET7_0_OR_GREATER +#if !NET8_0_OR_GREATER internal const string SspiCli = "sspicli.dll"; #endif } diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNICommon.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNICommon.cs index 9ccc98a779..2e5d3fd815 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNICommon.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNICommon.cs @@ -190,7 +190,7 @@ internal static bool ValidateSslServerCertificate(string targetServerName, X509C if (policyErrors.HasFlag(SslPolicyErrors.RemoteCertificateNameMismatch)) { -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER X509Certificate2 cert2 = cert as X509Certificate2; if (!cert2.MatchesHostname(targetServerName)) { @@ -297,7 +297,7 @@ internal static bool ValidateSslServerCertificate(X509Certificate clientCert, X5 if (policyErrors.HasFlag(SslPolicyErrors.RemoteCertificateNameMismatch)) { -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER X509Certificate2 s_cert = serverCert as X509Certificate2; X509Certificate2 c_cert = clientCert as X509Certificate2; diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs index ce3b9dd26b..e71b04e155 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs @@ -25,7 +25,7 @@ internal class SNIProxy private static readonly SNIProxy s_singleton = new SNIProxy(); internal static SNIProxy Instance => s_singleton; -#if !NET7_0_OR_GREATER +#if !NET8_0_OR_GREATER /// /// Generate SSPI context /// diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlDataReader.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlDataReader.cs index 5eb7d7cdeb..c538483fc8 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlDataReader.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlDataReader.cs @@ -1353,7 +1353,7 @@ override public string GetName(int i) } /// -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] #endif override public Type GetProviderSpecificFieldType(int i) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs index a2e510dd01..05308fde7b 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs @@ -6146,7 +6146,7 @@ internal bool TryReadSqlValue(SqlBuffer value, SqlMetaDataPriv md, int length, T } else { -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER value.SqlBinary = SqlBinary.WrapBytes(b); #else value.SqlBinary = SqlTypeWorkarounds.SqlBinaryCtor(b, true); // doesn't copy the byte array @@ -6443,7 +6443,7 @@ internal bool TryReadSqlValueInternal(SqlBuffer value, byte tdsType, int length, { return false; } -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER value.SqlBinary = SqlBinary.WrapBytes(b); #else value.SqlBinary = SqlTypeWorkarounds.SqlBinaryCtor(b, true); @@ -7315,7 +7315,7 @@ internal byte[] SerializeSqlDecimal(SqlDecimal d, TdsParserStateObject stateObj) Span data = stackalloc uint[4]; -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER d.WriteTdsValue(data); #else SqlTypeWorkarounds.SqlDecimalExtractData(d, out data[0], out data[1], out data[2], out data[3]); @@ -7344,7 +7344,7 @@ internal void WriteSqlDecimal(SqlDecimal d, TdsParserStateObject stateObj) stateObj.WriteByte(0); Span data = stackalloc uint[4]; -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER d.WriteTdsValue(data); #else SqlTypeWorkarounds.SqlDecimalExtractData(d, out data[0], out data[1], out data[2], out data[3]); diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs index 7d879ae4d5..b912ea9f09 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs @@ -408,7 +408,7 @@ private SNIHandle GetSessionSNIHandleHandleOrThrow() private void ThrowClosedConnection() => throw ADP.ClosedConnectionError(); internal override SSPIContextProvider CreateSSPIContextProvider() -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER => new NegotiateSSPIContextProvider(); #else => new ManagedSSPIContextProvider(); diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SSPI/NegotiateSSPIContextProvider.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SSPI/NegotiateSSPIContextProvider.cs index bc11cf29c9..2380693ef9 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SSPI/NegotiateSSPIContextProvider.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SSPI/NegotiateSSPIContextProvider.cs @@ -1,4 +1,4 @@ -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER using System; using System.Text; diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ValueUtilsSmi.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ValueUtilsSmi.cs index da931ae53f..7dd4abd7c1 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ValueUtilsSmi.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/ValueUtilsSmi.cs @@ -3174,7 +3174,7 @@ private static SqlMoney GetSqlMoney_Unchecked(SmiEventSink_Default sink, ITypedG long temp = getters.GetInt64(sink, ordinal); sink.ProcessMessagesAndThrow(); -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER return SqlMoney.FromTdsValue(temp); #else return SqlTypeWorkarounds.SqlMoneyCtor(temp, 1 /* ignored */ ); @@ -3658,7 +3658,7 @@ private static void SetSqlMoney_Unchecked(SmiEventSink_Default sink, ITypedSette sink.ProcessMessagesAndThrow(); } -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER setters.SetInt64(sink, ordinal, value.GetTdsValue()); #else setters.SetInt64(sink, ordinal, SqlTypeWorkarounds.SqlMoneyToSqlInternalRepresentation(value)); diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBuffer.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBuffer.cs index 71934c5e8a..f28bf6033b 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBuffer.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBuffer.cs @@ -886,7 +886,7 @@ internal SqlMoney SqlMoney { return SqlMoney.Null; } -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER return SqlMoney.FromTdsValue(_value._int64); #else return SqlTypeWorkarounds.SqlMoneyCtor(_value._int64, 1/*ignored*/); diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs index e50a202605..f826f96594 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs @@ -478,7 +478,7 @@ public static bool IsTargetReadyForAeWithKeyStore() public static bool IsSupportingDistributedTransactions() { -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER return OperatingSystem.IsWindows() && System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture != System.Runtime.InteropServices.Architecture.X86 && IsNotAzureServer(); #elif NETFRAMEWORK return IsNotAzureServer(); diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/DistributedTransactionTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/DistributedTransactionTest.cs index dc04ea56ae..658104e193 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/DistributedTransactionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/DistributedTransactionTest.cs @@ -8,7 +8,7 @@ using System.Transactions; using Xunit; -#if NET7_0_OR_GREATER +#if NET8_0_OR_GREATER namespace Microsoft.Data.SqlClient.ManualTesting.Tests {