Skip to content

Commit 4e235d3

Browse files
committed
Address PR comments and fix compiler error on unix since TdsParserSafeHandles only exist on windows
1 parent e2cbf9e commit 4e235d3

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,6 @@
475475
<Compile Include="..\..\src\Microsoft\Data\SqlClient\TdsParameterSetter.cs">
476476
<Link>Microsoft\Data\SqlClient\TdsParameterSetter.cs</Link>
477477
</Compile>
478-
<Compile Include="..\..\src\Microsoft\Data\SqlClient\TdsParserSafeHandles.cs">
479-
<Link>Microsoft\Data\SqlClient\TdsParserSafeHandles.cs</Link>
480-
</Compile>
481478
<Compile Include="..\..\src\Microsoft\Data\SqlClient\TdsRecordBufferSetter.cs">
482479
<Link>Microsoft\Data\SqlClient\TdsRecordBufferSetter.cs</Link>
483480
</Compile>
@@ -665,6 +662,9 @@
665662
<Compile Include="Microsoft\Data\SqlClient\SqlColumnEncryptionCertificateStoreProvider.Windows.cs" />
666663
<Compile Include="Microsoft\Data\SqlClient\SqlColumnEncryptionCngProvider.Windows.cs" />
667664
<Compile Include="Microsoft\Data\SqlClient\SqlColumnEncryptionCspProvider.Windows.cs" />
665+
<Compile Include="..\..\src\Microsoft\Data\SqlClient\TdsParserSafeHandles.cs">
666+
<Link>Microsoft\Data\SqlClient\TdsParserSafeHandles.cs</Link>
667+
</Compile>
668668
</ItemGroup>
669669
<!-- Unix only -->
670670
<ItemGroup Condition="'$(TargetsUnix)' == 'true'">

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ internal void Connect(ServerInfo serverInfo,
517517
// Clean up IsSQLDNSCachingSupported flag from previous status
518518
_connHandler.IsSQLDNSCachingSupported = false;
519519

520-
UInt32 sniStatus = SNILoadHandle.SingletonInstance.SNIStatus;
520+
UInt32 sniStatus = SNILoadHandle.SingletonInstance.Status;
521521
if (sniStatus != TdsEnums.SNI_SUCCESS)
522522
{
523523
_physicalStateObj.AddError(ProcessSNIError(_physicalStateObj));

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserSafeHandles.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
using System;
66
using System.Collections.Generic;
77
using System.Diagnostics;
8+
using System.Runtime.CompilerServices;
89
using System.Runtime.InteropServices;
910
using System.Threading;
1011
#if NETFRAMEWORK
11-
using System.Runtime.CompilerServices;
1212
using Microsoft.Data.Common;
1313
#endif
1414

@@ -53,7 +53,7 @@ public bool ClientOSEncryptionSupport
5353
{
5454
try
5555
{
56-
UInt32 value = 0;
56+
uint value = 0;
5757
// Query OS to find out whether encryption is supported.
5858
SNINativeMethodWrapper.SNIQueryInfo(SNINativeMethodWrapper.QTypes.SNI_QUERY_CLIENT_ENCRYPT_POSSIBLE, ref value);
5959
_clientOSEncryptionSupport = value != 0;
@@ -85,12 +85,7 @@ override protected bool ReleaseHandle()
8585
return true;
8686
}
8787

88-
#if NETFRAMEWORK
89-
// TODO: update references
90-
public uint SNIStatus => _sniStatus;
91-
#else
9288
public uint Status => _sniStatus;
93-
#endif
9489

9590
public EncryptionOptions Options => _encryptionOption;
9691

@@ -161,17 +156,15 @@ internal SNIHandle(
161156
bool flushCache,
162157
bool fSync,
163158
bool fParallel,
164-
#if NETFRAMEWORK
159+
#if NETFRAMEWORK
165160
TransparentNetworkResolutionState transparentNetworkResolutionState,
166161
int totalTimeout,
167-
#endif
162+
#endif
168163
SqlConnectionIPAddressPreference ipPreference,
169164
SQLDNSInfo cachedDNSInfo)
170165
: base(IntPtr.Zero, true)
171166
{
172-
#if NETFRAMEWORK
173167
RuntimeHelpers.PrepareConstrainedRegions();
174-
#endif
175168
try
176169
{ }
177170
finally

0 commit comments

Comments
 (0)