From 2aa3d69f9879af50af7f62ee413286d297bfbe7d Mon Sep 17 00:00:00 2001
From: Johnny Pham <23270162+johnnypham@users.noreply.github.com>
Date: Wed, 24 Mar 2021 12:45:52 -0700
Subject: [PATCH 1/2] remove api
---
.../Interop/SNINativeMethodWrapper.Windows.cs | 18 ------
.../src/Microsoft.Data.SqlClient.csproj | 5 --
.../netfx/src/Microsoft.Data.SqlClient.csproj | 3 -
.../Interop/SNINativeManagedWrapperX64.cs | 6 --
.../Interop/SNINativeManagedWrapperX86.cs | 6 --
.../Data/Interop/SNINativeMethodWrapper.cs | 26 --------
.../SqlClient/SqlClientEventSource.Windows.cs | 61 -------------------
7 files changed, 125 deletions(-)
delete mode 100644 src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.Windows.cs
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Interop/SNINativeMethodWrapper.Windows.cs b/src/Microsoft.Data.SqlClient/netcore/src/Interop/SNINativeMethodWrapper.Windows.cs
index e3b91c6ee5..8201ec41aa 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Interop/SNINativeMethodWrapper.Windows.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Interop/SNINativeMethodWrapper.Windows.cs
@@ -304,12 +304,6 @@ private static extern unsafe uint SNISecGenClientContextWrapper(
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
private static extern uint SNIWriteSyncOverAsync(SNIHandle pConn, [In] SNIPacket pPacket);
-
- [DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool RegisterTraceProviderWrapper(int eventKeyword);
-
- [DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void UnregisterTraceProviderWrapper();
#endregion
internal static uint SniGetConnectionId(SNIHandle pConn, ref Guid connId)
@@ -467,18 +461,6 @@ private static void MarshalConsumerInfo(ConsumerInfo consumerInfo, ref Sni_Consu
: IntPtr.Zero;
native_consumerInfo.ConsumerKey = consumerInfo.key;
}
-
- internal static bool RegisterTraceProvider(int eventKeyword)
- {
- // Registers the TraceLogging provider, enabling it to generate events.
- // Return true if enabled, otherwise false.
- return RegisterTraceProviderWrapper(eventKeyword);
- }
-
- internal static void UnregisterTraceProvider()
- {
- UnregisterTraceProviderWrapper();
- }
}
}
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj
index 12ce6b4f01..166c4d435c 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj
@@ -33,11 +33,6 @@
true
-
-
- Microsoft\Data\SqlClient\SqlClientEventSource.Windows.cs
-
-
Microsoft\Data\SqlClient\SqlClientEventSource.cs
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 58e0037059..f5987bfe3e 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
@@ -97,9 +97,6 @@
Microsoft\Data\SqlClient\SqlClientEventSource.cs
-
- Microsoft\Data\SqlClient\SqlClientEventSource.Windows.cs
-
Microsoft\Data\SqlClient\SqlClientLogger.cs
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX64.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX64.cs
index 3b2549e5de..0cddc32dc1 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX64.cs
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX64.cs
@@ -133,11 +133,5 @@ internal static extern unsafe uint SNISecGenClientContextWrapper(
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr SNIClientCertificateFallbackWrapper(IntPtr pCallbackContext);
-
- [DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool RegisterTraceProviderWrapper(int eventKeyword);
-
- [DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void UnregisterTraceProviderWrapper();
}
}
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX86.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX86.cs
index fc1e90750c..398ecc4872 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX86.cs
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeManagedWrapperX86.cs
@@ -133,11 +133,5 @@ internal static extern unsafe uint SNISecGenClientContextWrapper(
[DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr SNIClientCertificateFallbackWrapper(IntPtr pCallbackContext);
-
- [DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
- internal static extern bool RegisterTraceProviderWrapper(int eventKeyword);
-
- [DllImport(SNI, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void UnregisterTraceProviderWrapper();
}
}
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs
index a79e0e71e5..0ac874b8b6 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs
@@ -1075,32 +1075,6 @@ private static void MarshalConsumerInfo(ConsumerInfo consumerInfo, ref Sni_Consu
: IntPtr.Zero;
native_consumerInfo.ConsumerKey = consumerInfo.key;
}
-
- internal static bool RegisterTraceProvider(int eventKeyword)
- {
- // Registers the TraceLogging provider, enabling it to generate events.
- // Return true if enabled, otherwise false.
- if (s_is64bitProcess)
- {
- return SNINativeManagedWrapperX64.RegisterTraceProviderWrapper(eventKeyword);
- }
- else
- {
- return SNINativeManagedWrapperX86.RegisterTraceProviderWrapper(eventKeyword);
- }
- }
-
- internal static void UnregisterTraceProvider()
- {
- if (s_is64bitProcess)
- {
- SNINativeManagedWrapperX64.UnregisterTraceProviderWrapper();
- }
- else
- {
- SNINativeManagedWrapperX86.UnregisterTraceProviderWrapper();
- }
- }
}
}
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.Windows.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.Windows.cs
deleted file mode 100644
index a4b3f0bded..0000000000
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlClientEventSource.Windows.cs
+++ /dev/null
@@ -1,61 +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.Diagnostics;
-using System.Diagnostics.Tracing;
-
-namespace Microsoft.Data.SqlClient
-{
- internal partial class SqlClientEventSource : SqlClientEventSourceBase
- {
- private bool _traceLoggingProviderEnabled = false;
-
- ///
- /// Captures application flow traces from native networking implementation
- ///
- private const EventCommand SNINativeTrace = (EventCommand)8192;
-
- ///
- /// Captures scope trace events from native networking implementation
- ///
- private const EventCommand SNINativeScope = (EventCommand)16384;
-
- ///
- /// Disables all event tracing in native networking implementation
- ///
- private const EventCommand SNINativeDisable = (EventCommand)32768;
-
- protected override void OnEventCommand(EventCommandEventArgs e)
- {
- base.OnEventCommand(e);
- // Internally, EventListener.EnableEvents sends an event command, with a reserved value of 0, -2, or -3.
- // When a command is sent via EnableEvents or SendCommand, check if it is a user-defined value
- // to enable or disable event tracing in sni.dll.
- // If registration fails, all write and unregister commands will be a no-op.
-
- // If managed networking is enabled, don't call native wrapper methods
-#if NETCOREAPP || NETSTANDARD
- if (AppContext.TryGetSwitch("Switch.Microsoft.Data.SqlClient.UseManagedNetworkingOnWindows", out bool isEnabled) && isEnabled)
- {
- return;
- }
-#endif
- // Only register the provider if it's not already registered. Registering a provider that is already
- // registered can lead to unpredictable behaviour.
- if (!_traceLoggingProviderEnabled && e.Command > 0 && (e.Command & (SNINativeTrace | SNINativeScope)) != 0)
- {
- int eventKeyword = (int)(e.Command & (SNINativeTrace | SNINativeScope));
- _traceLoggingProviderEnabled = SNINativeMethodWrapper.RegisterTraceProvider(eventKeyword);
- Debug.Assert(_traceLoggingProviderEnabled, "Failed to enable TraceLogging provider.");
- }
- else if (_traceLoggingProviderEnabled && (e.Command == SNINativeDisable))
- {
- // Only unregister the provider if it's currently registered.
- SNINativeMethodWrapper.UnregisterTraceProvider();
- _traceLoggingProviderEnabled = false;
- }
- }
- }
-}
From d793836a358a4c73d8800e148b235cb66a6ec9dc Mon Sep 17 00:00:00 2001
From: Johnny Pham <23270162+johnnypham@users.noreply.github.com>
Date: Thu, 15 Apr 2021 14:00:23 -0700
Subject: [PATCH 2/2] update sni version
---
tools/props/Versions.props | 4 ++--
tools/specs/Microsoft.Data.SqlClient.nuspec | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/props/Versions.props b/tools/props/Versions.props
index fc96c72988..d9c9b32704 100644
--- a/tools/props/Versions.props
+++ b/tools/props/Versions.props
@@ -11,7 +11,7 @@
- 2.1.1
+ 3.0.0-preview1.21104.2
4.3.1
4.3.0
@@ -27,7 +27,7 @@
4.7.0
- 2.1.1
+ 3.0.0-preview1.21104.2
4.7.0
4.7.0
4.7.0
diff --git a/tools/specs/Microsoft.Data.SqlClient.nuspec b/tools/specs/Microsoft.Data.SqlClient.nuspec
index 6f27e7e6b1..b79652c15e 100644
--- a/tools/specs/Microsoft.Data.SqlClient.nuspec
+++ b/tools/specs/Microsoft.Data.SqlClient.nuspec
@@ -28,13 +28,13 @@ When using NuGet 3.x this package requires at least version 3.4.
sqlclient microsoft.data.sqlclient
-
+
-
+
@@ -46,7 +46,7 @@ When using NuGet 3.x this package requires at least version 3.4.
-
+
@@ -58,7 +58,7 @@ When using NuGet 3.x this package requires at least version 3.4.
-
+
@@ -70,7 +70,7 @@ When using NuGet 3.x this package requires at least version 3.4.
-
+