Skip to content

Commit 728f467

Browse files
authored
Cleanup | Remove unused members (#3803)
1 parent 70ec559 commit 728f467

File tree

15 files changed

+8
-432
lines changed

15 files changed

+8
-432
lines changed

src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,6 @@
149149
<Compile Include="$(CommonSourceRoot)\Interop\Windows\NtDll\SecurityQualityOfService.cs">
150150
<Link>Interop\Windows\NtDll\SecurityQualityOfService.cs</Link>
151151
</Compile>
152-
<Compile Include="$(CommonSourceRoot)\Interop\Windows\Secur32\CredHandle.netfx.cs">
153-
<Link>Interop\Windows\Secur32\CredHandle.netfx.cs</Link>
154-
</Compile>
155-
<Compile Include="$(CommonSourceRoot)\Interop\Windows\Secur32\ContextAttribute.netfx.cs">
156-
<Link>Interop\Windows\Secur32\ContextAttribute.netfx.cs</Link>
157-
</Compile>
158-
<Compile Include="$(CommonSourceRoot)\Interop\Windows\Secur32\Secur32.netfx.cs">
159-
<Link>Interop\Windows\Secur32\Secur32.netfx.cs</Link>
160-
</Compile>
161152
<Compile Include="$(CommonSourceRoot)\Interop\Windows\Sni\AuthProviderInfo.cs">
162153
<Link>Interop\Windows\Sni\AuthProviderInfo.cs</Link>
163154
</Compile>

src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32Safe.netfx.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,10 @@ internal static class Kernel32Safe
2121
{
2222
private const string Kernel32 = "kernel32.dll";
2323

24-
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getcomputernameex.asp
25-
[DllImport(Kernel32, CharSet = CharSet.Unicode, EntryPoint = "GetComputerNameExW", SetLastError = true)]
26-
[ResourceExposure(ResourceScope.None)]
27-
internal static extern int GetComputerNameEx(int nameType, StringBuilder nameBuffer, ref int bufferSize);
28-
2924
[DllImport(Kernel32, CharSet = CharSet.Auto)]
3025
[ResourceExposure(ResourceScope.Process)]
3126
internal static extern int GetCurrentProcessId();
3227

33-
[DllImport(Kernel32, CharSet = CharSet.Auto, BestFitMapping = false, ThrowOnUnmappableChar = true)]
34-
[ResourceExposure(ResourceScope.Process)]
35-
internal static extern IntPtr GetModuleHandle([MarshalAs(UnmanagedType.LPTStr), In] string moduleName);
36-
3728
[DllImport(Kernel32, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true, SetLastError = true)]
3829
[ResourceExposure(ResourceScope.None)]
3930
internal static extern IntPtr GetProcAddress(IntPtr HModule, [MarshalAs(UnmanagedType.LPStr), In] string funcName);

src/Microsoft.Data.SqlClient/src/Interop/Windows/Secur32/ContextAttribute.netfx.cs

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/Microsoft.Data.SqlClient/src/Interop/Windows/Secur32/CredHandle.netfx.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Microsoft.Data.SqlClient/src/Interop/Windows/Secur32/Secur32.netfx.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,6 @@ internal static InvalidOperationException MethodCalledTwice(string method)
361361
return e;
362362
}
363363

364-
internal static ArgumentOutOfRangeException ArgumentOutOfRange(string message, string parameterName, object value)
365-
{
366-
ArgumentOutOfRangeException e = new(parameterName, value, message);
367-
TraceExceptionAsReturnValue(e);
368-
return e;
369-
}
370-
371364
internal static AuthenticationException SSLCertificateAuthenticationException(string message)
372365
{
373366
AuthenticationException e = new(message);
@@ -457,9 +450,6 @@ internal static ArgumentOutOfRangeException InvalidUserDefinedTypeSerializationF
457450
return InvalidEnumerationValue(typeof(Format), (int)value);
458451
}
459452

460-
internal static ArgumentOutOfRangeException NotSupportedUserDefinedTypeSerializationFormat(Format value, string method)
461-
=> NotSupportedEnumerationValue(typeof(Format), value.ToString(), method);
462-
463453
internal static ArgumentException InvalidArgumentLength(string argumentName, int limit)
464454
=> Argument(StringsHelper.GetString(Strings.ADP_InvalidArgumentLength, argumentName, limit));
465455

@@ -1079,9 +1069,6 @@ internal static Exception InvalidDataLength(long length)
10791069
internal static bool CompareInsensitiveInvariant(string strvalue, string strconst)
10801070
=> 0 == CultureInfo.InvariantCulture.CompareInfo.Compare(strvalue, strconst, CompareOptions.IgnoreCase);
10811071

1082-
internal static int DstCompare(string strA, string strB) // this is null safe
1083-
=> CultureInfo.CurrentCulture.CompareInfo.Compare(strA, strB, ADP.DefaultCompareOptions);
1084-
10851072
internal static void SetCurrentTransaction(Transaction transaction) => Transaction.Current = transaction;
10861073

10871074
internal static Exception NonSeqByteAccess(long badIndex, long currIndex, string method)
@@ -1237,11 +1224,6 @@ internal static Exception UndefinedCollection(string collectionName)
12371224
internal static Exception AmbiguousCollectionName(string collectionName)
12381225
=> Argument(StringsHelper.GetString(Strings.MDF_AmbiguousCollectionName, collectionName));
12391226

1240-
internal static Exception MissingDataSourceInformationColumn() => Argument(StringsHelper.GetString(Strings.MDF_MissingDataSourceInformationColumn));
1241-
1242-
internal static Exception IncorrectNumberOfDataSourceInformationRows()
1243-
=> Argument(StringsHelper.GetString(Strings.MDF_IncorrectNumberOfDataSourceInformationRows));
1244-
12451227
internal static Exception MissingRestrictionColumn() => Argument(StringsHelper.GetString(Strings.MDF_MissingRestrictionColumn));
12461228

12471229
internal static Exception MissingRestrictionRow() => Argument(StringsHelper.GetString(Strings.MDF_MissingRestrictionRow));
@@ -1398,13 +1380,6 @@ internal static Exception InvalidMixedUsageOfAccessTokenCallbackAndIntegratedSec
13981380
internal static readonly IntPtr s_ptrZero = IntPtr.Zero;
13991381
#if NETFRAMEWORK
14001382
#region netfx project only
1401-
internal static Task<T> CreatedTaskWithException<T>(Exception ex)
1402-
{
1403-
TaskCompletionSource<T> completion = new();
1404-
completion.SetException(ex);
1405-
return completion.Task;
1406-
}
1407-
14081383
//
14091384
// Helper Functions
14101385
//
@@ -1501,14 +1476,6 @@ internal static Exception PermissionTypeMismatch()
15011476
return Argument(StringsHelper.GetString(Strings.ADP_PermissionTypeMismatch));
15021477
}
15031478

1504-
//
1505-
// DbDataReader
1506-
//
1507-
internal static Exception NumericToDecimalOverflow()
1508-
{
1509-
return InvalidCast(StringsHelper.GetString(Strings.ADP_NumericToDecimalOverflow));
1510-
}
1511-
15121479
//
15131480
// DbDataAdapter
15141481
//
@@ -1526,79 +1493,12 @@ internal static InvalidOperationException ComputerNameEx(int lastError)
15261493
internal const float FailoverTimeoutStepForTnir = 0.125F; // Fraction of timeout to use in case of Transparent Network IP resolution.
15271494
internal const int MinimumTimeoutForTnirMs = 500; // The first login attempt in Transparent network IP Resolution
15281495

1529-
internal static readonly int s_ptrSize = IntPtr.Size;
1530-
internal static readonly IntPtr s_invalidPtr = new(-1); // use for INVALID_HANDLE
1531-
15321496
internal static readonly bool s_isWindowsNT = (PlatformID.Win32NT == Environment.OSVersion.Platform);
1533-
internal static readonly bool s_isPlatformNT5 = (ADP.s_isWindowsNT && (Environment.OSVersion.Version.Major >= 5));
1534-
1535-
[FileIOPermission(SecurityAction.Assert, AllFiles = FileIOPermissionAccess.PathDiscovery)]
1536-
[ResourceExposure(ResourceScope.Machine)]
1537-
[ResourceConsumption(ResourceScope.Machine)]
1538-
internal static string GetFullPath(string filename)
1539-
{ // MDAC 77686
1540-
return Path.GetFullPath(filename);
1541-
}
1542-
1543-
// TODO: cache machine name and listen to longhorn event to reset it
1544-
internal static string GetComputerNameDnsFullyQualified()
1545-
{
1546-
const int ComputerNameDnsFullyQualified = 3; // winbase.h, enum COMPUTER_NAME_FORMAT
1547-
const int ERROR_MORE_DATA = 234; // winerror.h
1548-
1549-
string value;
1550-
if (s_isPlatformNT5)
1551-
{
1552-
int length = 0; // length parameter must be zero if buffer is null
1553-
// query for the required length
1554-
// VSTFDEVDIV 479551 - ensure that GetComputerNameEx does not fail with unexpected values and that the length is positive
1555-
int getComputerNameExError = 0;
1556-
if (0 == Kernel32Safe.GetComputerNameEx(ComputerNameDnsFullyQualified, null, ref length))
1557-
{
1558-
getComputerNameExError = Marshal.GetLastWin32Error();
1559-
}
1560-
if ((getComputerNameExError != 0 && getComputerNameExError != ERROR_MORE_DATA) || length <= 0)
1561-
{
1562-
throw ADP.ComputerNameEx(getComputerNameExError);
1563-
}
1564-
1565-
StringBuilder buffer = new(length);
1566-
length = buffer.Capacity;
1567-
if (0 == Kernel32Safe.GetComputerNameEx(ComputerNameDnsFullyQualified, buffer, ref length))
1568-
{
1569-
throw ADP.ComputerNameEx(Marshal.GetLastWin32Error());
1570-
}
1571-
1572-
// Note: In Longhorn you'll be able to rename a machine without
1573-
// rebooting. Therefore, don't cache this machine name.
1574-
value = buffer.ToString();
1575-
}
1576-
else
1577-
{
1578-
value = ADP.MachineName();
1579-
}
1580-
return value;
1581-
}
1582-
1583-
internal static IntPtr IntPtrOffset(IntPtr pbase, int offset)
1584-
{
1585-
if (4 == ADP.s_ptrSize)
1586-
{
1587-
return (IntPtr)checked(pbase.ToInt32() + offset);
1588-
}
1589-
Debug.Assert(8 == ADP.s_ptrSize, "8 != IntPtr.Size"); // MDAC 73747
1590-
return (IntPtr)checked(pbase.ToInt64() + offset);
1591-
}
15921497

15931498
#endregion
15941499
#else
15951500
#region netcore project only
15961501

1597-
//
1598-
// COM+ exceptions
1599-
//
1600-
internal static PlatformNotSupportedException DbTypeNotSupported(string dbType) => new(StringsHelper.GetString(Strings.SQL_DbTypeNotSupportedOnThisPlatform, dbType));
1601-
16021502
// IDbConnection.BeginTransaction, OleDbTransaction.Begin
16031503
internal static ArgumentOutOfRangeException InvalidIsolationLevel(IsolationLevel value)
16041504
{

src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/ConnectionString/DbConnectionString.netfx.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,10 @@ internal DbConnectionString(
5151
string value,
5252
string restrictions,
5353
KeyRestrictionBehavior behavior,
54-
IReadOnlyDictionary<string, string> synonyms,
55-
bool useOdbcRules)
54+
IReadOnlyDictionary<string, string> synonyms)
5655
: this(new DbConnectionOptions(value, synonyms), restrictions, behavior, synonyms, false)
5756
{
58-
// useOdbcRules is only used to parse the connection string, not to parse restrictions because values don't apply there
59-
// the hashtable doesn't need clone since it isn't shared with anything else
57+
// The IReadOnlyDictionary doesn't need to be cloned since it isn't shared with anything else
6058
}
6159

6260
internal DbConnectionString(DbConnectionOptions connectionOptions)

src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,9 +675,6 @@ internal void MakePooledConnection(IDbConnectionPool connectionPool)
675675
Pool = connectionPool;
676676
}
677677

678-
internal void NotifyWeakReference(int message) =>
679-
ReferenceCollection?.Notify(message);
680-
681678
internal virtual void OpenConnection(DbConnection outerConnection, SqlConnectionFactory connectionFactory)
682679
{
683680
if (!TryOpenConnection(outerConnection, connectionFactory, null, null))

src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbReferenceCollection.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ internal T FindItem<T>(int refInfo, Func<T, bool> filterMethod) where T : class
174174
return null;
175175
}
176176

177-
public void Notify(int message)
177+
public void Deactivate()
178178
{
179179
bool lockObtained = false;
180180
try
@@ -186,14 +186,14 @@ public void Notify(int message)
186186
{
187187
_isNotifying = true;
188188

189-
// Loop through each live item and notify it
189+
// Loop through each live item and notify it of its parent's deactivation
190190
if (_estimatedCount > 0)
191191
{
192192
for (int index = 0; index <= _lastItemIndex; ++index)
193193
{
194194
if (_items[index].TryGetTarget(out object value))
195195
{
196-
NotifyItem(message, _items[index].RefInfo, value);
196+
NotifyItem(_items[index].RefInfo, value);
197197
_items[index].RemoveTarget();
198198
}
199199
Debug.Assert(!_items[index].TryGetTarget(out _), "Unexpected target after notifying");
@@ -220,7 +220,7 @@ public void Notify(int message)
220220
}
221221
}
222222

223-
abstract protected void NotifyItem(int message, int refInfo, object value);
223+
abstract protected void NotifyItem(int refInfo, object value);
224224

225225
abstract public void Remove(object value);
226226

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientPermission.netfx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private bool _IsUnrestricted
106106
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlClientPermission.xml' path='docs/members[@name="SqlClientPermission"]/Add[@name="connectionStringAndrestrictionsStringAndBehavior"]/*' />
107107
public override void Add(string connectionString, string restrictions, KeyRestrictionBehavior behavior)
108108
{
109-
DbConnectionString constr = new DbConnectionString(connectionString, restrictions, behavior, SqlConnectionString.KeywordMap, false);
109+
DbConnectionString constr = new DbConnectionString(connectionString, restrictions, behavior, SqlConnectionString.KeywordMap);
110110
AddPermissionEntry(constr);
111111
}
112112

0 commit comments

Comments
 (0)