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 1d9c1985bd..f09d342860 100644
--- a/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj
+++ b/src/Microsoft.Data.SqlClient/netfx/ref/Microsoft.Data.SqlClient.csproj
@@ -21,13 +21,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 f8041d0d61..4c37763ce3 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
@@ -73,7 +73,7 @@
- $(DefineConstants);DEBUG;DBG;_DEBUG;_LOGGING;RESOURCE_ANNOTATION_WORK;
+ $(DefineConstants);DEBUG;DBG;_DEBUG;_LOGGING;
Full
False
@@ -83,15 +83,9 @@
True
-
-
-
-
-
-
-
+
diff --git a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32.cs b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32.cs
index a938fa2fcc..a5b854f565 100644
--- a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32.cs
+++ b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32.cs
@@ -6,7 +6,6 @@
using System;
using System.Runtime.InteropServices;
-using System.Runtime.Versioning;
using System.Text;
using Microsoft.Data.Common;
using Microsoft.Win32.SafeHandles;
@@ -67,7 +66,6 @@ internal static extern bool DeviceIoControl(
#if NETFRAMEWORK
[DllImport(DllName, SetLastError = true, CharSet = CharSet.Unicode)]
- [ResourceExposure(ResourceScope.Machine)]
internal static extern int GetFullPathName(
string path,
int numBufferChars,
diff --git a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32Safe.netfx.cs b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32Safe.netfx.cs
index 506cf92c0c..874614765f 100644
--- a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32Safe.netfx.cs
+++ b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32Safe.netfx.cs
@@ -6,7 +6,6 @@
using System;
using System.Runtime.InteropServices;
-using System.Runtime.Versioning;
using System.Security;
namespace Interop.Windows.Kernel32
@@ -21,11 +20,9 @@ internal static class Kernel32Safe
private const string Kernel32 = "kernel32.dll";
[DllImport(Kernel32, CharSet = CharSet.Auto)]
- [ResourceExposure(ResourceScope.Process)]
internal static extern int GetCurrentProcessId();
[DllImport(Kernel32, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true, SetLastError = true)]
- [ResourceExposure(ResourceScope.None)]
internal static extern IntPtr GetProcAddress(IntPtr HModule, [MarshalAs(UnmanagedType.LPStr), In] string funcName);
}
}
diff --git a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Sni/SniNativeWrapper.cs b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Sni/SniNativeWrapper.cs
index a563cf73b9..62961901ff 100644
--- a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Sni/SniNativeWrapper.cs
+++ b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Sni/SniNativeWrapper.cs
@@ -14,9 +14,6 @@
using Microsoft.Data.SqlClient.Utilities;
#if NETFRAMEWORK
-using System.Runtime.CompilerServices;
-using System.Runtime.Versioning;
-using System.Security;
using Interop.Windows;
#endif
@@ -66,8 +63,6 @@ internal static uint SniAddProvider(SNIHandle pConn, Provider provNum, ref AuthP
s_nativeMethods.SniAddProvider(pConn, provNum, ref pInfo);
#if NETFRAMEWORK
- [ResourceExposure(ResourceScope.None)]
- [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
internal static uint SniAddProvider(SNIHandle pConn,
Provider providerEnum,
AuthProviderInfo authInfo)
diff --git a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Sni/SqlDependencyProcessDispatcherStorage.netfx.cs b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Sni/SqlDependencyProcessDispatcherStorage.netfx.cs
index 19d8b261c3..dc5b5be57e 100644
--- a/src/Microsoft.Data.SqlClient/src/Interop/Windows/Sni/SqlDependencyProcessDispatcherStorage.netfx.cs
+++ b/src/Microsoft.Data.SqlClient/src/Interop/Windows/Sni/SqlDependencyProcessDispatcherStorage.netfx.cs
@@ -7,7 +7,6 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
-using System.Runtime.Versioning;
namespace Interop.Windows.Sni
{
@@ -17,8 +16,6 @@ internal class SqlDependencyProcessDispatcherStorage
private static IntPtr s_data;
private static int s_size;
- [ResourceExposure(ResourceScope.Process)] // SxS: there is no way to set scope = Instance, using Process which is wider
- [ResourceConsumption(ResourceScope.Process, ResourceScope.Process)]
public static byte[] NativeGetData()
{
byte[] result = null;
@@ -31,8 +28,6 @@ public static byte[] NativeGetData()
return result;
}
- [ResourceExposure(ResourceScope.Process)] // SxS: there is no way to set scope = Instance, using Process which is wider
- [ResourceConsumption(ResourceScope.Process, ResourceScope.Process)]
internal static void NativeSetData(byte[] data)
{
lock (s_lockObj)
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs
index dcd9f4bac9..44f5d45654 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs
@@ -30,7 +30,6 @@
#endif
#if _WINDOWS
-using System.Runtime.Versioning;
using Microsoft.Win32;
#endif
@@ -438,8 +437,6 @@ internal static object LocalMachineRegistryValue(string subkey, string queryvalu
}
#endif
#if _WINDOWS
- [ResourceExposure(ResourceScope.Machine)]
- [ResourceConsumption(ResourceScope.Machine)]
internal static object LocalMachineRegistryValue(string subkey, string queryvalue)
{
#if NETFRAMEWORK
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.netfx.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.netfx.cs
index c7427a6a8d..ac9ed992de 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.netfx.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.netfx.cs
@@ -9,7 +9,6 @@
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
-using System.Runtime.Versioning;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/ConnectionString/DbConnectionOptions.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/ConnectionString/DbConnectionOptions.cs
index ea5e5a149c..57f1f0e0d3 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/ConnectionString/DbConnectionOptions.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/ConnectionString/DbConnectionOptions.cs
@@ -11,7 +11,6 @@
using System.Text.RegularExpressions;
#if NETFRAMEWORK
-using System.Runtime.Versioning;
using System.Security;
#endif
@@ -591,10 +590,6 @@ internal NameValuePair ReplacePasswordPwd(out string constr, bool fakePassword)
// * this method queries "DataDirectory" value from the current AppDomain.
// This string is used for to replace "!DataDirectory!" values in the connection string, it is not considered as an "exposed resource".
// * This method uses GetFullPath to validate that root path is valid, the result is not exposed out.
- #if NETFRAMEWORK
- [ResourceExposure(ResourceScope.None)]
- [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
- #endif
internal static string ExpandDataDirectory(string keyword, string value)
{
string fullPath = null;
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolIdentity.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolIdentity.cs
index 7eca7bd0f6..fda939eb29 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolIdentity.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolIdentity.cs
@@ -4,10 +4,6 @@
using System;
-#if NETFRAMEWORK
-using System.Runtime.Versioning;
-#endif
-
#if _WINDOWS
using System.Security.Principal;
#endif
@@ -59,10 +55,6 @@ public override int GetHashCode()
return _hashCode;
}
- #if NETFRAMEWORK
- [ResourceConsumption(ResourceScope.Process, ResourceScope.Process)]
- [ResourceExposure(ResourceScope.None)] // SxS: this method does not create named objects
- #endif
internal static DbConnectionPoolIdentity GetCurrent()
{
#if NETFRAMEWORK
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/WaitHandleDbConnectionPool.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/WaitHandleDbConnectionPool.cs
index ae56af3bcd..9d89b563dd 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/WaitHandleDbConnectionPool.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/WaitHandleDbConnectionPool.cs
@@ -9,7 +9,6 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
-using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using System.Transactions;
@@ -88,10 +87,6 @@ private sealed class PoolWaitHandles
private readonly WaitHandle[] _handlesWithCreate;
private readonly WaitHandle[] _handlesWithoutCreate;
-#if NETFRAMEWORK
- [ResourceExposure(ResourceScope.None)] // SxS: this method does not create named objects
- [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
-#endif
internal PoolWaitHandles()
{
_poolSemaphore = new Semaphore(0, MAX_Q_SIZE);
@@ -934,8 +929,6 @@ public bool TryGetConnection(DbConnection owningObject, TaskCompletionSource {0}", ObjectID);
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnection.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnection.cs
index 46852a5df4..da7521a4cd 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnection.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnection.cs
@@ -9,11 +9,6 @@
using Microsoft.Data.Common;
using Microsoft.Data.ProviderBase;
-#if NETFRAMEWORK
-using System.Runtime.CompilerServices;
-using System.Runtime.ConstrainedExecution;
-#endif
-
namespace Microsoft.Data.SqlClient
{
internal abstract class SqlInternalConnection : DbConnectionInternal
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
index 540cf3b95c..acadbe11da 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
@@ -16,12 +16,7 @@
using System.Transactions;
using Interop.Common.Sni;
using Microsoft.Data.Common;
-
-#if NETFRAMEWORK
-using System.Runtime.InteropServices;
-using System.Runtime.Versioning;
-using Interop.Windows.Kernel32;
-#else
+#if NET
using System.Net.Sockets;
#endif
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStaticMethods.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStaticMethods.cs
index 569a3fbc16..56ead6a4a2 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStaticMethods.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStaticMethods.cs
@@ -5,7 +5,6 @@
using System;
using System.Globalization;
using System.Runtime.InteropServices;
-using System.Runtime.Versioning;
using Microsoft.Data.Common;
namespace Microsoft.Data.SqlClient
@@ -18,9 +17,6 @@ private TdsParserStaticMethods() { /* prevent utility class from being insantiat
// Static methods
//
- // SxS: this method accesses registry to resolve the alias.
- [ResourceExposure(ResourceScope.None)]
- [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
static internal void AliasRegistryLookup(ref string host, ref string protocol)
{
if (!string.IsNullOrEmpty(host))
@@ -168,8 +164,6 @@ internal static int GetCurrentThreadIdForTdsLoginOnly()
private static byte[] s_nicAddress = null;
- [ResourceExposure(ResourceScope.None)] // SxS: we use MAC address for TDS login only
- [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
static internal byte[] GetNetworkPhysicalAddressForTdsLoginOnly()
{
if (s_nicAddress != null)
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlTypes/SqlFileStream.windows.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlTypes/SqlFileStream.windows.cs
index 9338cf03b1..3c1c9c7bf8 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlTypes/SqlFileStream.windows.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlTypes/SqlFileStream.windows.cs
@@ -20,7 +20,6 @@
using Microsoft.Win32.SafeHandles;
#if NETFRAMEWORK
-using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
@@ -510,10 +509,6 @@ private static void DemandAccessPermission (string path, FileAccess access)
}
#endif
- #if NETFRAMEWORK
- [ResourceExposure(ResourceScope.Machine)]
- [ResourceConsumption(ResourceScope.Machine)]
- #endif
private static string GetFullPathInternal(string path)
{
//-----------------------------------------------------------------
@@ -562,8 +557,6 @@ private static string GetFullPathInternal(string path)
/// Do not use this in netcore - Path.GetFullPathName does not require additional
/// permissions like netfx does.
///
- [ResourceExposure(ResourceScope.Machine)]
- [ResourceConsumption(ResourceScope.Machine)]
private static string GetFullPathNameNetfx(string path)
{
// In the most common case where (SqlFileStream),the 'full path' is expected to be the