Skip to content

Merge | Managed SNI #3345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9166de8
Move all SNI files to common project
benrr101 May 12, 2025
a24243e
Move all managed SNI classes to ManagedSni namespace
benrr101 May 12, 2025
1b5f94b
SNIError => SniError
benrr101 May 13, 2025
94c0b32
SNIHandle => SniHandle
benrr101 May 13, 2025
9b85b56
SNILoadHandle => SniLoadHandle
benrr101 May 13, 2025
7315977
SNIMarsConnection => SniMarsConnection
benrr101 May 13, 2025
fd9462c
SNIMarsHandle => SniMarsHandle
benrr101 May 13, 2025
43cb86f
SNINpHandle => SniNpHandle
benrr101 May 13, 2025
c182939
SNIPacket => SniPacket
benrr101 May 13, 2025
af09268
SNIPhysicalHandle => SniPhysicalHandle
benrr101 May 13, 2025
8689b48
SNIProxy => SniProxy
benrr101 May 13, 2025
3665a81
SNITcpHandle => SniTcpHandle
benrr101 May 13, 2025
e763ca5
Extract SniAsyncCallback to its own file
benrr101 May 13, 2025
cc284dd
Extract SniProviders to its own file
benrr101 May 13, 2025
389a7e9
Extract SniSmuxHeader to its own file
benrr101 May 13, 2025
11fc387
Extract SniSmuxFlags to its own file
benrr101 May 13, 2025
c18012e
SNICommon => SniCommon
benrr101 May 13, 2025
d7e2be4
Extract SniSslStream to its own file
benrr101 May 13, 2025
2ae42d1
Extract SniNetworkStream to its own file, delete SniStreams file
benrr101 May 13, 2025
a06eff1
Merge value task partial into the appropriate stream classes
benrr101 May 13, 2025
b7928ab
Wrap all files in #if NET
benrr101 May 13, 2025
8fcf840
SNISMUXHeader => SniSmuxHeader ... whoops
benrr101 May 13, 2025
1588899
Merge branch 'main' into dev/russellben/merge/netcore-sni
benrr101 May 16, 2025
4d333f6
Rename SSRP to SsrpClient
benrr101 May 19, 2025
54c77ca
Change reflection references to SNI
benrr101 May 19, 2025
ad28fa0
Fix release-only reference
benrr101 May 20, 2025
8cb8837
I can't trust any changes I make to the test projects, so I'm just go…
benrr101 May 20, 2025
11c2305
Merge branch 'main' into dev/russellben/merge/netcore-sni
benrr101 May 28, 2025
23b0553
Merge branch 'main' into dev/russellben/merge/netcore-sni
benrr101 May 29, 2025
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 @@ -275,6 +275,69 @@
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\LocalAppContextSwitches.cs">
<Link>Microsoft\Data\SqlClient\LocalAppContextSwitches.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\ConcurrentQueueSemaphore.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\ConcurrentQueueSemaphore.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniAsyncCallback.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniAsyncCallback.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniError.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniError.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniCommon.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniCommon.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniHandle.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniHandle.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniLoadHandle.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniLoadHandle.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniMarsConnection.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniMarsConnection.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniMarsHandle.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniMarsHandle.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniNetworkStream.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniNetworkStream.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniNpHandle.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniNpHandle.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniPacket.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniPacket.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniPhysicalHandle.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniPhysicalHandle.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniProviders.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniProviders.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniProxy.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniProxy.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniSmuxFlags.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniSmuxFlags.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniSmuxHeader.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniSmuxHeader.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniSslStream.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniSslStream.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniTcpHandle.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SniTcpHandle.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SslOverTdsStream.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SslOverTdsStream.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SslOverTdsStream.NetCoreApp.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SslOverTdsStream.NetCoreApp.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SsrpClient.netcore.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\SsrpClient.netcore.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\NoneAttestationEnclaveProvider.cs">
<Link>Microsoft\Data\SqlClient\NoneAttestationEnclaveProvider.cs</Link>
</Compile>
Expand Down Expand Up @@ -731,25 +794,8 @@
<Compile Include="$(CommonSourceRoot)System\Diagnostics\CodeAnalysis.cs">
<Link>System\Diagnostics\CodeAnalysis.cs</Link>
</Compile>

<Compile Include="Microsoft\Data\Common\ConnectionString\DbConnectionOptions.netcore.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\ConcurrentQueueSemaphore.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIError.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNICommon.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIHandle.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNILoadHandle.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIMarsConnection.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIMarsHandle.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNINpHandle.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIPacket.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIPhysicalHandle.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIProxy.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIStreams.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIStreams.ValueTask.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SNITcpHandle.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SslOverTdsStream.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SslOverTdsStream.NetCoreApp.cs" />
<Compile Include="Microsoft\Data\SqlClient\SNI\SSRP.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlAppContextSwitchManager.NetCoreApp.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlBulkCopy.cs" />
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionFactory.AssemblyLoadContext.cs" />
Expand Down Expand Up @@ -882,6 +928,9 @@
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\LocalDb\LocalDbApi.Windows.cs">
<Link>Microsoft\Data\SqlClient\LocalDb\LocalDbApi.Windows.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\LocalDB.netcore.Windows.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\LocalDB.netcore.Windows.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\PacketHandle.Windows.cs">
<Link>Microsoft\Data\SqlClient\PacketHandle.Windows.cs</Link>
</Compile>
Expand Down Expand Up @@ -910,7 +959,6 @@
<Link>Microsoft\Data\SqlTypes\SqlFileStream.Windows.cs</Link>
</Compile>

<Compile Include="Microsoft\Data\SqlClient\SNI\LocalDB.Windows.cs" />
<Compile Include="Microsoft\Data\SqlClient\TdsParser.Windows.cs" />
<Compile Include="Microsoft\Data\SqlClient\TdsParserStateObjectNative.cs" />
</ItemGroup>
Expand All @@ -929,6 +977,9 @@
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\LocalDb\LocalDbApi.Unix.cs">
<Link>Microsoft\Data\SqlClient\LocalDb\LocalDbApi.Unix.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\LocalDB.netcore.Unix.cs">
<Link>Microsoft\Data\SqlClient\ManagedSni\LocalDB.netcore.Unix.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\PacketHandle.netcore.Unix.cs">
<Link>Microsoft\Data\SqlClient\PacketHandle.netcore.Unix.cs</Link>
</Compile>
Expand All @@ -951,7 +1002,6 @@
<Link>Microsoft\Data\SqlTypes\SqlFileStream.netcore.Unix.cs</Link>
</Compile>

<Compile Include="Microsoft\Data\SqlClient\SNI\LocalDB.Unix.cs" />
<Compile Include="Microsoft\Data\SqlClient\TdsParser.Unix.cs" />
</ItemGroup>

Expand Down

This file was deleted.

This file was deleted.

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.

using Microsoft.Data.SqlClient.SNI;
using Microsoft.Data.SqlClient.ManagedSni;

namespace Microsoft.Data.SqlClient
{
Expand All @@ -26,7 +26,7 @@ private void WaitForSSLHandShakeToComplete(ref uint error, ref int protocolVersi
private SNIErrorDetails GetSniErrorDetails()
{
SNIErrorDetails details;
SNIError sniError = SNIProxy.Instance.GetLastError();
SniError sniError = SniProxy.Instance.GetLastError();
details.sniErrorNumber = sniError.sniError;
details.errorMessage = sniError.errorMessage;
details.nativeError = sniError.nativeError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
using System;
using System.Diagnostics;
using Interop.Windows.Sni;
using Microsoft.Data.SqlClient.SNI;
using Microsoft.Data.SqlClient.ManagedSni;
using SniError = Microsoft.Data.SqlClient.ManagedSni.SniError;

namespace Microsoft.Data.SqlClient
{
Expand Down Expand Up @@ -68,7 +69,7 @@ private SNIErrorDetails GetSniErrorDetails()

if (TdsParserStateObjectFactory.UseManagedSNI)
{
SNIError sniError = SNIProxy.Instance.GetLastError();
SniError sniError = SniProxy.Instance.GetLastError();
details.sniErrorNumber = sniError.sniError;
details.errorMessage = sniError.errorMessage;
details.nativeError = sniError.nativeError;
Expand All @@ -79,7 +80,7 @@ private SNIErrorDetails GetSniErrorDetails()
}
else
{
SniNativeWrapper.SniGetLastError(out SniError sniError);
SniNativeWrapper.SniGetLastError(out Interop.Windows.Sni.SniError sniError);
details.sniErrorNumber = sniError.sniError;
details.errorMessage = sniError.errorMessage;
details.nativeError = sniError.nativeError;
Expand Down
Loading
Loading