Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ public static partial class SqlClientMetaDataCollectionNames
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientMetaDataCollectionNames.xml' path='docs/members[@name="SqlClientMetaDataCollectionNames"]/StructuredTypeMembers/*' />
public static readonly string StructuredTypeMembers;
}
#if NETCOREAPP
#if NET6_0_OR_GREATER
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlConnectionAttestationProtocol.xml' path='docs/members[@name="SqlConnectionAttestationProtocol"]/SqlConnectionAttestationProtocol/*' />
public enum SqlConnectionAttestationProtocol
{
Expand Down Expand Up @@ -1017,7 +1017,7 @@ public SqlConnectionStringBuilder(string connectionString) { }
[System.ComponentModel.DisplayNameAttribute("Data Source")]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
public string DataSource { get { throw null; } set { } }
#if NETCOREAPP
#if NET6_0_OR_GREATER
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml' path='docs/members[@name="SqlConnectionStringBuilder"]/AttestationProtocol/*' />
[System.ComponentModel.DisplayNameAttribute("Attestation Protocol")]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
Expand Down Expand Up @@ -1444,7 +1444,7 @@ internal SqlException() { }
public byte State { get { throw null; } }

/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlException.xml' path='docs/members[@name="SqlException"]/GetObjectData/*'/>
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
[System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags = System.Security.Permissions.SecurityPermissionFlag.SerializationFormatter)]
#endif
#if NET8_0_OR_GREATER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using System.Diagnostics.Tracing;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
#if net462
#if NETFRAMEWORK
using System.Security;
#endif

Expand Down Expand Up @@ -45,7 +45,7 @@ namespace System.Net
// method that takes an object and optionally provides a string representation of it, in case a particular library wants to customize further.

/// <summary>Provides logging facilities for System.Net libraries.</summary>
#if net462
#if NETFRAMEWORK
[SecuritySafeCritical]
#endif
internal sealed partial class NetEventSource : EventSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if NETCOREAPP
#if NET6_0_OR_GREATER

using System.Diagnostics;
using Microsoft.Data.Common;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ private DbConnectionInternal CreateObject(DbConnection owningObject, DbConnectio
throw;
}

#if NETCOREAPP
#if NET6_0_OR_GREATER
if (!IsBlockingPeriodEnabled())
{
throw;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ public override void KillConnection()

internal static void SetKeepAliveValues(ref Socket socket)
{
#if NETCOREAPP
#if NET6_0_OR_GREATER
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveInterval, 1);
socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveTime, 30);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3994,7 +3994,7 @@ private SqlDataReader GetParameterEncryptionDataReader(out Task returnTask, Task
SqlCommand command = (SqlCommand)state;
bool processFinallyBlockAsync = true;
bool decrementAsyncCountInFinallyBlockAsync = true;
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
Expand Down Expand Up @@ -4068,7 +4068,7 @@ private SqlDataReader GetParameterEncryptionDataReaderAsync(out Task returnTask,
bool processFinallyBlockAsync = true;
bool decrementAsyncCountInFinallyBlockAsync = true;

#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void Initialize()
SqlInternalConnection connection = _connection;
SqlConnection usersConnection = connection.Connection;
SqlClientEventSource.Log.TryTraceEvent("SqlDelegatedTransaction.Initialize | RES | CPOOL | Object Id {0}, Client Connection Id {1}, delegating transaction.", ObjectID, usersConnection?.ClientConnectionId);
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
Expand Down Expand Up @@ -146,7 +146,7 @@ public byte[] Promote()
{
SqlConnection usersConnection = connection.Connection;
SqlClientEventSource.Log.TryTraceEvent("SqlDelegatedTransaction.Promote | RES | CPOOL | Object Id {0}, Client Connection Id {1}, promoting transaction.", ObjectID, usersConnection?.ClientConnectionId);
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
Expand Down Expand Up @@ -256,7 +256,7 @@ public void Rollback(SinglePhaseEnlistment enlistment)
{
SqlConnection usersConnection = connection.Connection;
SqlClientEventSource.Log.TryTraceEvent("SqlDelegatedTransaction.Rollback | RES | CPOOL | Object Id {0}, Client Connection Id {1}, rolling back transaction.", ObjectID, usersConnection?.ClientConnectionId);
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
Expand Down Expand Up @@ -343,7 +343,7 @@ public void SinglePhaseCommit(SinglePhaseEnlistment enlistment)
{
SqlConnection usersConnection = connection.Connection;
SqlClientEventSource.Log.TryTraceEvent("SqlDelegatedTransaction.SinglePhaseCommit | RES | CPOOL | Object Id {0}, Client Connection Id {1}, committing transaction.", ObjectID, usersConnection?.ClientConnectionId);
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2300,7 +2300,7 @@ internal bool TryGetFedAuthTokenLocked(SqlFedAuthInfo fedAuthInfo, DbConnectionP
bool authenticationContextLocked = false;

// Prepare CER to ensure the lock on authentication context is released.
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,7 @@ internal void WriteInt(int v, TdsParserStateObject stateObj)

internal static void WriteInt(Span<byte> buffer, int value)
{
#if NETCOREAPP
#if NET6_0_OR_GREATER
BinaryPrimitives.TryWriteInt32LittleEndian(buffer, value);
#else
buffer[0] = (byte)(value & 0xff);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ internal override uint WaitForSSLHandShakeToComplete(out int protocolVersion)
{
protocolVersion = (int)SslProtocols.Tls12;
}
#if NETCOREAPP
#if NET6_0_OR_GREATER
else if (nativeProtocol.HasFlag(NativeProtocols.SP_PROT_TLS1_3_CLIENT) || nativeProtocol.HasFlag(NativeProtocols.SP_PROT_TLS1_3_SERVER))
{
/* The SslProtocols.Tls13 is supported by netcoreapp3.1 and later */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public override void Flush()
}

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlTypes/SqlFileStream.xml' path='docs/members[@name="SqlFileStream"]/BeginRead/*' />
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
[HostProtection(ExternalThreading = true)]
#endif
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
Expand All @@ -318,7 +318,7 @@ public override int EndRead(IAsyncResult asyncResult)
}

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlTypes/SqlFileStream.xml' path='docs/members[@name="SqlFileStream"]/BeginWrite/*' />
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
[HostProtection(ExternalThreading = true)]
#endif
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal static partial class ADP
[ResourceConsumption(ResourceScope.Machine)]
internal static object LocalMachineRegistryValue(string subkey, string queryvalue)
{ // MDAC 77697
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
(new RegistryPermission(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\\" + subkey)).Assert(); // MDAC 62028
#endif
try
Expand All @@ -43,7 +43,7 @@ internal static object LocalMachineRegistryValue(string subkey, string queryvalu
ADP.TraceExceptionWithoutRethrow(e);
return null;
}
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
finally
{
RegistryPermission.RevertAssert();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ private static long TimerToSeconds(long timerValue)
/// Note: In Longhorn you'll be able to rename a machine without
/// rebooting. Therefore, don't cache this machine name.
/// </summary>
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
[EnvironmentPermission(SecurityAction.Assert, Read = "COMPUTERNAME")]
#endif
internal static string MachineName() => Environment.MachineName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ internal bool LockToUpdate()
/// <summary>
/// Release the lock which was obtained through LockToUpdate.
/// </summary>
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
internal void ReleaseLockToUpdate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal static class SqlDataSourceEnumeratorNativeHelper
/// <returns></returns>
internal static DataTable GetDataSources()
{
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
(new NamedPermissionSet("FullTrust")).Demand(); // SQLBUDT 244304
#endif
char[] buffer = null;
Expand All @@ -37,13 +37,13 @@ internal static DataTable GetDataSources()
bool more = true;
bool failure = false;
IntPtr handle = ADP.s_ptrZero;
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
{
long s_timeoutTime = TdsParserStaticMethods.GetTimeoutSeconds(ADP.DefaultCommandTimeout);
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public override async Task<SqlAuthenticationToken> AcquireTokenAsync(SqlAuthenti
*/
string redirectUri = s_nativeClientRedirectUri;

#if NETCOREAPP
#if NET6_0_OR_GREATER
if (parameters.AuthenticationMethod != SqlAuthenticationMethod.ActiveDirectoryDeviceCodeFlow)
{
redirectUri = "http://localhost";
Expand Down Expand Up @@ -361,7 +361,7 @@ private static async Task<AuthenticationResult> AcquireTokenInteractiveDeviceFlo
if (authenticationMethod == SqlAuthenticationMethod.ActiveDirectoryInteractive)
{
CancellationTokenSource ctsInteractive = new CancellationTokenSource();
#if NETCOREAPP
#if NET6_0_OR_GREATER
/*
* On .NET Core, MSAL will start the system browser as a separate process. MSAL does not have control over this browser,
* but once the user finishes authentication, the web page is redirected in such a way that MSAL can intercept the Uri.
Expand Down Expand Up @@ -492,8 +492,6 @@ private IPublicClientApplication CreateClientAppInstance(PublicClientAppKey publ
.WithParentActivityOrWindow(_iWin32WindowFunc)
.Build();
}
#endif
#if !NETCOREAPP
else
#endif
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private enum Tristate : byte
private static Tristate s_makeReadAsyncBlocking;
private static Tristate s_useMinimumLoginTimeout;

#if !NETFRAMEWORK
#if NET6_0_OR_GREATER
static LocalAppContextSwitches()
{
IAppContextSwitchOverridesSection appContextSwitch = AppConfigManager.FetchConfigurationSection<AppContextSwitchOverridesSection>(AppContextSwitchOverridesSection.Name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public SqlConfigurableRetryLogicLoader(ISqlConfigurableRetryConnectionSection co
string cnnSectionName = SqlConfigurableRetryConnectionSection.Name,
string cmdSectionName = SqlConfigurableRetryCommandSection.Name)
{
#if !NETFRAMEWORK
#if NET6_0_OR_GREATER
// Just only one subscription to this event is required.
// This class isn't supposed to be called more than one time;
// SqlConfigurableRetryLogicManager manages a single instance of this class.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NETFRAMEWORK && !NET7_0_OR_GREATER
#if NET6_0

using Microsoft.Data.SqlClient.SNI;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using Microsoft.Data.Common;
using Microsoft.Data.SqlTypes;

#if !NETFRAMEWORK
#if NET6_0_OR_GREATER
using SmiContext = System.Object;
#endif

Expand Down Expand Up @@ -3174,7 +3174,7 @@ private static SqlMoney GetSqlMoney_Unchecked(SmiEventSink_Default sink, ITypedG

long temp = getters.GetInt64(sink, ordinal);
sink.ProcessMessagesAndThrow();
#if NETCOREAPP && NET7_0_OR_GREATER
#if NET7_0_OR_GREATER
return SqlMoney.FromTdsValue(temp);
#else
return SqlTypeWorkarounds.SqlMoneyCtor(temp, 1 /* ignored */ );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ internal SqlMoney SqlMoney
{
return SqlMoney.Null;
}
#if NETCOREAPP && NET7_0_OR_GREATER
#if NET7_0_OR_GREATER
return SqlMoney.FromTdsValue(_value._int64);
#else
return SqlTypeWorkarounds.SqlMoneyCtor(_value._int64, 1/*ignored*/);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ public static void DeriveParameters(SqlCommand command)
}
#if NETFRAMEWORK
TdsParser bestEffortCleanupTarget = null;
#endif
#if !NET6_0_OR_GREATER
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ internal static Dictionary<string, string> GetParseSynonyms()
{

int count = SqlConnectionStringBuilder.KeywordsCount + SynonymCount;
#if !NETFRAMEWORK
#if NET6_0_OR_GREATER
count += SqlConnectionStringBuilder.DeprecatedKeywordsCount + DeprecatedSynonymCount;
#endif
synonyms = new Dictionary<string, string>(count, StringComparer.OrdinalIgnoreCase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ private void SetPoolBlockingPeriodValue(PoolBlockingPeriod value)

private Exception UnsupportedKeyword(string keyword)
{
#if !NETFRAMEWORK
#if NET6_0_OR_GREATER
for (int index = 0; index < s_notSupportedKeywords.Length; index++)
{
if (string.Equals(keyword, s_notSupportedKeywords[index], StringComparison.OrdinalIgnoreCase))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ internal static bool Start(string connectionString, string queue, bool useDefaul
string database = null;
string service = null;
bool appDomainStart = false;
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
Expand Down Expand Up @@ -775,7 +775,7 @@ internal static bool Stop(string connectionString, string queue, bool useDefault
if (useDefaults)
{
bool appDomainStop = false;
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if NETCOREAPP
#if NET6_0_OR_GREATER

using System;
using System.Reflection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private SqlDependencyPerAppDomainDispatcher()
}
}

#if NETCOREAPP
#if NET6_0_OR_GREATER
partial void SubscribeToAppDomainUnload();

partial void SubscribeToAssemblyLoadContextUnload();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ public override string SourceColumn

/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlParameter.xml' path='docs/members[@name="SqlParameter"]/SourceColumnNullMapping/*' />
[ResCategory("DataCategory_Update")]
#if !NETFRAMEWORK
#if NET6_0_OR_GREATER
[ResDescription(StringsHelper.ResourceNames.SqlParameter_SourceColumnNullMapping)]
#endif
public override bool SourceColumnNullMapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ internal SNIHandle(
string hostNameInCertificate)
: base(IntPtr.Zero, true)
{
#if !NET6_0_OR_GREATER
#if NETFRAMEWORK
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ internal bool TryProcessHeader()
_inBuff[_inBytesUsed + TdsEnums.HEADER_LEN_FIELD_OFFSET + 1]) - _inputHeaderLen;
_spid = _inBuff[_inBytesUsed + TdsEnums.SPID_OFFSET] << 8 |
_inBuff[_inBytesUsed + TdsEnums.SPID_OFFSET + 1];
#if !NETFRAMEWORK
#if NET6_0_OR_GREATER
SqlClientEventSource.Log.TryAdvancedTraceEvent("TdsParserStateObject.TryProcessHeader | ADV | State Object Id {0}, Client Connection Id {1}, Server process Id (SPID) {2}", _objectID, _parser?.Connection?.ClientConnectionId, _spid);
#endif
_inBytesUsed += _inputHeaderLen;
Expand Down
Loading